llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-webassembly Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> The -wasm-enable-eh backend flag was redundant with -exception-model=wasm: every caller paired the two, and the model already carries the intent. Co-authored-by: Claude (Claude-Opus-4.8) <noreply@<!-- -->anthropic.com> --- Patch is 40.05 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/224313.diff 28 Files Affected: - (modified) clang/lib/Driver/ToolChains/WebAssembly.cpp (+1-5) - (removed) clang/test/CodeGen/WebAssembly/exception-model-flag.c (-16) - (modified) clang/test/CodeGen/WebAssembly/wasm-exception-model-flag-parse-ir-input.ll (+1-1) - (modified) clang/test/CodeGen/exception-model-flag.c (+8) - (modified) clang/test/CodeGenCXX/builtins-eh-wasm.cpp (+1-1) - (modified) clang/test/CodeGenCXX/wasm-eh.cpp (+6-6) - (modified) clang/test/CodeGenObjC/wasm32-eh-arc.m (+1-1) - (modified) clang/test/CodeGenObjC/wasm32-eh.m (+1-1) - (modified) clang/test/CodeGenObjCXX/wasm32-eh-objcxx.mm (+1-1) - (modified) clang/test/Driver/wasm-toolchain.c (+2-2) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyCodeGenPassBuilder.cpp (+2-3) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (+5-21) - (modified) llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h (-1) - (modified) llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.ll (+5-5) - (modified) llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.mir (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll (+5-5) - (modified) llvm/test/CodeGen/WebAssembly/eh-lsda.ll (+6-6) - (modified) llvm/test/CodeGen/WebAssembly/eh-option-errors.ll (+1-7) - (modified) llvm/test/CodeGen/WebAssembly/exception-legacy.ll (+3-3) - (modified) llvm/test/CodeGen/WebAssembly/exception-legacy.mir (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/exception.ll (+5-5) - (modified) llvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj-phi.ll (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj.ll (+2-2) - (modified) llvm/test/CodeGen/WebAssembly/null-streamer.ll (+2-2) - (modified) llvm/test/CodeGen/WebAssembly/wasm-eh-em-sjlj-error.ll (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/wasm-eh-invalid-personality.ll (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/wasm-eh-prepare.ll (+1-1) - (modified) llvm/test/CodeGen/WebAssembly/wasm-eh-sjlj-setjmp-within-catch.ll (+1-1) ``````````diff diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index b28154772f9f9..4487798b85fcc 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -456,9 +456,6 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, if (DriverArgs.getLastArg(options::OPT_fwasm_exceptions)) { BanIncompatibleOptionsForWasmEHSjLj("-fwasm-exceptions"); EnableFeaturesForWasmEHSjLj(); - // Backend needs -wasm-enable-eh to enable Wasm EH - CC1Args.push_back("-mllvm"); - CC1Args.push_back("-wasm-enable-eh"); } for (const Arg *A : DriverArgs.filtered(options::OPT_mllvm)) { @@ -483,8 +480,7 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, } } - for (const auto *Option : - {"-wasm-enable-eh", "-wasm-enable-sjlj", "-wasm-use-legacy-eh"}) { + for (const auto *Option : {"-wasm-enable-sjlj", "-wasm-use-legacy-eh"}) { if (Opt.starts_with(Option)) { BanIncompatibleOptionsForWasmEHSjLj(Option); EnableFeaturesForWasmEHSjLj(); diff --git a/clang/test/CodeGen/WebAssembly/exception-model-flag.c b/clang/test/CodeGen/WebAssembly/exception-model-flag.c deleted file mode 100644 index 35b56db409b0b..0000000000000 --- a/clang/test/CodeGen/WebAssembly/exception-model-flag.c +++ /dev/null @@ -1,16 +0,0 @@ -// REQUIRES: webassembly-registered-target - -// Verify clang records the "exception-model" module flag for the WebAssembly -// exception models. The target-independent models are covered in -// exception-model-flag.c. - -// Wasm EH (needs the backend enable flag) records the "wasm" model. -// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -exception-model=wasm -mllvm -wasm-enable-eh -emit-llvm %s -o - | FileCheck %s --check-prefix=WASM - -// Emscripten EH records the "emscripten" model. -// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fexceptions -exception-model=emscripten -emit-llvm %s -o - | FileCheck %s --check-prefix=EMSCRIPTEN - -void f(void) {} - -// WASM: !{i32 1, !"exception-model", !"wasm"} -// EMSCRIPTEN: !{i32 1, !"exception-model", !"emscripten"} diff --git a/clang/test/CodeGen/WebAssembly/wasm-exception-model-flag-parse-ir-input.ll b/clang/test/CodeGen/WebAssembly/wasm-exception-model-flag-parse-ir-input.ll index 8263c98670aab..1410de231660a 100644 --- a/clang/test/CodeGen/WebAssembly/wasm-exception-model-flag-parse-ir-input.ll +++ b/clang/test/CodeGen/WebAssembly/wasm-exception-model-flag-parse-ir-input.ll @@ -2,7 +2,7 @@ ; Check all the options parse ; RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm -exception-model=none %s | FileCheck %s -; RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm -exception-model=wasm -mllvm -wasm-enable-eh %s | FileCheck %s +; RUN: %clang_cc1 -triple wasm32 -o - -emit-llvm -exception-model=wasm %s | FileCheck %s ; RUN: not %clang_cc1 -triple wasm32 -o - -emit-llvm -exception-model=invalid %s 2>&1 | FileCheck -check-prefix=ERR %s ; RUN: not %clang_cc1 -triple wasm32 -o - -emit-llvm -exception-model=dwarf %s 2>&1 | FileCheck -check-prefix=ERR-BE %s diff --git a/clang/test/CodeGen/exception-model-flag.c b/clang/test/CodeGen/exception-model-flag.c index f9713d88df592..797a9965ab5f4 100644 --- a/clang/test/CodeGen/exception-model-flag.c +++ b/clang/test/CodeGen/exception-model-flag.c @@ -13,6 +13,12 @@ // SEH maps to the "wineh" spelling regardless of the requesting triple. // RUN: %clang_cc1 -triple i686-unknown-windows-gnu -fexceptions -exception-model=seh -emit-llvm %s -o - | FileCheck %s --check-prefix=WINEH +// Wasm EH records the "wasm" model. +// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -exception-model=wasm -emit-llvm %s -o - | FileCheck %s --check-prefix=WASM + +// Emscripten EH records the "emscripten" model. +// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fexceptions -exception-model=emscripten -emit-llvm %s -o - | FileCheck %s --check-prefix=EMSCRIPTEN + // A requested model that matches the target default is still recorded, so that // the flag's absence always means "unspecified". // RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -exception-model=dwarf -emit-llvm %s -o - | FileCheck %s --check-prefix=DWARF @@ -30,6 +36,8 @@ void f(void) {} // SJLJ: !{i32 1, !"exception-model", !"sjlj"} // WINEH: !{i32 1, !"exception-model", !"wineh"} +// WASM: !{i32 1, !"exception-model", !"wasm"} +// EMSCRIPTEN: !{i32 1, !"exception-model", !"emscripten"} // DWARF: !{i32 1, !"exception-model", !"dwarf"} // NONE: !{i32 1, !"exception-model", !"none"} // UNSPEC-NOT: "exception-model" diff --git a/clang/test/CodeGenCXX/builtins-eh-wasm.cpp b/clang/test/CodeGenCXX/builtins-eh-wasm.cpp index b3a6ffc92e11b..dfb0116e19428 100644 --- a/clang/test/CodeGenCXX/builtins-eh-wasm.cpp +++ b/clang/test/CodeGenCXX/builtins-eh-wasm.cpp @@ -1,5 +1,5 @@ // REQUIRES: webassembly-registered-target -// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -mllvm -wasm-enable-eh -exception-model=wasm -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -exception-model=wasm -emit-llvm -o - %s | FileCheck %s // Check if __builtin_wasm_throw and __builtin_wasm_rethrow are correctly // invoked when placed in try-catch. diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index 0b87107e476c7..a6dd939be733e 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -3,8 +3,8 @@ // RUN: %clang -E -dM %s -target wasm32-unknown-unknown -fwasm-exceptions | FileCheck %s -check-prefix PREPROCESSOR // PREPROCESSOR: #define __WASM_EXCEPTIONS__ 1 -// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s -// RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s +// RUN: %clang_cc1 %s -triple wasm64-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 | FileCheck %s // Test code generation for Wasm EH using WebAssembly EH proposal. // (https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) @@ -421,9 +421,9 @@ int tls_wrapper_within_funclet() { // CHECK-NEXT: call void @_ZSt9terminatev() -// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-DEFAULT -// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -Wwasm-exception-spec -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-ON -// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -Wno-wasm-exception-spec -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-OFF +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-DEFAULT +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -Wwasm-exception-spec -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-ON +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -Wno-wasm-exception-spec -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=WARNING-OFF // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s --check-prefix=EM-EH-WARNING // Wasm EH ignores dynamic exception specifications with types at the moment. @@ -448,7 +448,7 @@ void exception_spec_throw_empty() throw() { // Here we only check if the command enables wasm exception handling in the // backend so that exception handling instructions can be generated in .s file. -// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -mllvm -wasm-enable-eh -exception-model=wasm -target-feature +exception-handling -S -o - -std=c++11 | FileCheck %s --check-prefix=ASSEMBLY +// RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fms-extensions -fexceptions -fcxx-exceptions -exception-model=wasm -target-feature +exception-handling -S -o - -std=c++11 | FileCheck %s --check-prefix=ASSEMBLY // ASSEMBLY: try // ASSEMBLY: catch diff --git a/clang/test/CodeGenObjC/wasm32-eh-arc.m b/clang/test/CodeGenObjC/wasm32-eh-arc.m index 3d78d633953c6..021084906eccb 100644 --- a/clang/test/CodeGenObjC/wasm32-eh-arc.m +++ b/clang/test/CodeGenObjC/wasm32-eh-arc.m @@ -1,5 +1,5 @@ // REQUIRES: webassembly-registered-target -// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fobjc-runtime=gnustep-2.2 -fobjc-arc -fexceptions -fobjc-exceptions -exception-model=wasm -mllvm -wasm-enable-eh -emit-llvm -o - %s | FileCheck --enable-var-scope %s +// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fobjc-runtime=gnustep-2.2 -fobjc-arc -fexceptions -fobjc-exceptions -exception-model=wasm -emit-llvm -o - %s | FileCheck --enable-var-scope %s __attribute__((objc_root_class)) @interface Object @end extern void mayThrowObjC(); diff --git a/clang/test/CodeGenObjC/wasm32-eh.m b/clang/test/CodeGenObjC/wasm32-eh.m index 09062bdea1894..d25f17319b76e 100644 --- a/clang/test/CodeGenObjC/wasm32-eh.m +++ b/clang/test/CodeGenObjC/wasm32-eh.m @@ -1,5 +1,5 @@ // REQUIRES: webassembly-registered-target -// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fobjc-exceptions -fexceptions -exception-model=wasm -mllvm -wasm-enable-eh -emit-llvm -fobjc-runtime=gnustep-2.2 -o - %s | FileCheck --enable-var-scope %s +// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fobjc-exceptions -fexceptions -exception-model=wasm -emit-llvm -fobjc-runtime=gnustep-2.2 -o - %s | FileCheck --enable-var-scope %s __attribute__((objc_root_class)) @interface Object @end diff --git a/clang/test/CodeGenObjCXX/wasm32-eh-objcxx.mm b/clang/test/CodeGenObjCXX/wasm32-eh-objcxx.mm index 3af09f7055b98..cfc87f4fe5b54 100644 --- a/clang/test/CodeGenObjCXX/wasm32-eh-objcxx.mm +++ b/clang/test/CodeGenObjCXX/wasm32-eh-objcxx.mm @@ -1,5 +1,5 @@ // REQUIRES: webassembly-registered-target -// RUN: %clang_cc1 -target-feature +exception-handling -triple wasm32-unknown-emscripten -fobjc-runtime=gnustep-2.2 -fexceptions -fobjc-exceptions -fcxx-exceptions -exception-model=wasm -mllvm -wasm-enable-eh -emit-llvm -o - %s | FileCheck --enable-var-scope %s +// RUN: %clang_cc1 -target-feature +exception-handling -triple wasm32-unknown-emscripten -fobjc-runtime=gnustep-2.2 -fexceptions -fobjc-exceptions -fcxx-exceptions -exception-model=wasm -emit-llvm -o - %s | FileCheck --enable-var-scope %s struct ThrowingDestructor { ~ThrowingDestructor() noexcept(false); diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index 7a36440494f42..e5fadaba174da 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -155,11 +155,11 @@ // WASM_EXCEPTIONS_FEMSCRIPTEN_EH: invalid argument '-fwasm-exceptions' not allowed with '-femscripten-exceptions' // '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types, -// "-exception-model=wasm", and '-mllvm -wasm-enable-eh' +// and "-exception-model=wasm" // RUN: %clang -### --target=wasm32-unknown-unknown \ // RUN: --sysroot=/foo %s -fwasm-exceptions 2>&1 \ // RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS %s -// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" "-mllvm" "-wasm-enable-eh" +// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" // '-fwasm-exceptions' not allowed with '-mllvm -enable-emscripten-sjlj' // RUN: not %clang -### --target=wasm32-unknown-unknown \ diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCodeGenPassBuilder.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCodeGenPassBuilder.cpp index c53072764bc82..960f01f1e73a0 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyCodeGenPassBuilder.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCodeGenPassBuilder.cpp @@ -41,13 +41,11 @@ using namespace llvm; namespace WebAssembly { extern cl::opt<bool> WasmDisableExplicitLocals; -extern cl::opt<bool> WasmEnableEH; extern cl::opt<bool> WasmEnableEmSjLj; extern cl::opt<bool> WasmEnableSjLj; } // namespace WebAssembly using llvm::WebAssembly::WasmDisableExplicitLocals; -using llvm::WebAssembly::WasmEnableEH; using llvm::WebAssembly::WasmEnableEmSjLj; using llvm::WebAssembly::WasmEnableSjLj; @@ -126,7 +124,8 @@ void WebAssemblyCodeGenPassBuilder::addIRPasses(PassManagerWrapper &PMW) { // passes and Emscripten SjLj handling expects all invokes to be lowered // before. bool EnableEmEH = TM.Options.ExceptionModel == ExceptionHandling::Emscripten; - if (!EnableEmEH && !WasmEnableEH) { + bool EnableWasmEH = TM.Options.ExceptionModel == ExceptionHandling::Wasm; + if (!EnableEmEH && !EnableWasmEH) { addFunctionPass(LowerInvokePass(), PMW); // The lower invoke pass may create unreachable code. Remove it in order not // to process dead blocks in setjmp/longjmp handling. diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 3b054f80027c5..6c15b2e3b5864 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -57,10 +57,6 @@ cl::opt<bool> WebAssembly::WasmEnableEmSjLj( "enable-emscripten-sjlj", cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"), cl::init(false)); -// Exception handling using wasm EH instructions -cl::opt<bool> - WebAssembly::WasmEnableEH("wasm-enable-eh", - cl::desc("WebAssembly exception handling")); // setjmp/longjmp handling using wasm EH instructions cl::opt<bool> WebAssembly::WasmEnableSjLj( "wasm-enable-sjlj", cl::desc("WebAssembly setjmp/longjmp handling")); @@ -129,7 +125,6 @@ static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) { } using WebAssembly::WasmDisableExplicitLocals; -using WebAssembly::WasmEnableEH; using WebAssembly::WasmEnableEmSjLj; using WebAssembly::WasmEnableSjLj; @@ -137,10 +132,6 @@ static void basicCheckForEHAndSjLj(TargetMachine *TM) { bool EnableEmEH = TM->Options.ExceptionModel == ExceptionHandling::Emscripten; - // You can't enable two modes of EH at the same time - if (EnableEmEH && WasmEnableEH) - report_fatal_error( - "-exception-model=emscripten not allowed with -wasm-enable-eh"); // You can't enable two modes of SjLj at the same time if (WasmEnableEmSjLj && WasmEnableSjLj) report_fatal_error( @@ -151,9 +142,9 @@ static void basicCheckForEHAndSjLj(TargetMachine *TM) { "-exception-model=emscripten not allowed with -wasm-enable-sjlj"); if (TM->Options.ExceptionModel == ExceptionHandling::Default) { - // FIXME: These flags should be removed in favor of directly using the - // generically configured ExceptionsType - if (WebAssembly::WasmEnableEH || WebAssembly::WasmEnableSjLj) + // FIXME: This flag should be removed in favor of directly using the + // generically configured ExceptionsType. + if (WebAssembly::WasmEnableSjLj) TM->Options.ExceptionModel = ExceptionHandling::Wasm; } @@ -164,17 +155,9 @@ static void basicCheckForEHAndSjLj(TargetMachine *TM) { TM->Options.ExceptionModel != ExceptionHandling::Emscripten) report_fatal_error( "-exception-model should be either 'none', 'wasm', or 'emscripten'"); - if (WasmEnableEH && TM->Options.ExceptionModel != ExceptionHandling::Wasm) - report_fatal_error( - "-wasm-enable-eh only allowed with -exception-model=wasm"); if (WasmEnableSjLj && TM->Options.ExceptionModel != ExceptionHandling::Wasm) report_fatal_error( "-wasm-enable-sjlj only allowed with -exception-model=wasm"); - if ((!WasmEnableEH && !WasmEnableSjLj) && - TM->Options.ExceptionModel == ExceptionHandling::Wasm) - report_fatal_error( - "-exception-model=wasm only allowed with at least one of " - "-wasm-enable-eh or -wasm-enable-sjlj"); // Currently it is allowed to mix Wasm EH with Emscripten SjLj as an interim // measure, but some code will error out at compile time in this combination. @@ -334,7 +317,8 @@ void WebAssemblyPassConfig::addIRPasses() { // passes and Emscripten SjLj handling expects all invokes to be lowered // before. bool EnableEmEH = TM->Options.ExceptionModel == ExceptionHandling::Emscripten; - if (!EnableEmEH && !WasmEnableEH) { + bool EnableWasmEH = TM->Options.ExceptionModel == ExceptionHandling::Wasm; + if (!EnableEmEH && !EnableWasmEH) { addPass(createLowerInvokePass()); // The lower invoke pass may create unreachable code. Remove it in order not // to process dead blocks in setjmp/longjmp handling. diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h index cff4d345b8516..a7ff3f4afa9b7 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h @@ -25,7 +25,6 @@ namespace WebAssembly { // Exception handling / setjmp-longjmp handling command-line options extern cl::opt<bool> WasmDisableExplicitLocals; extern cl::opt<bool> WasmEnableEmSjLj; // asm.js-style SjLJ -extern cl::opt<bool> WasmEnableEH; // EH using Wasm EH instructions extern cl::opt<bool> WasmEnableSjLj; // SjLj using Wasm EH instructions extern cl::opt<bool> WasmUseLegacyEH; // Legacy Wasm EH } // namespace WebAssembly diff --git a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.ll b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.ll index b3bf255b2391e..7b7827a71d47d 100644 --- a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.ll +++ b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh-legacy.ll @@ -1,9 +1,9 @@ ; REQUIRES: asserts -; RUN: llc < %s -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -disable-block-placement -verify-machineinstrs -fast-isel=false -machine-sink-split-probability-threshold=0 -cgp-freq-ratio-to-skip-merge=1000 -wasm-enable-eh -wasm-use-legacy-eh -exception-model=wasm -mattr=+exception-handling,bulk-memory | FileCheck %s -; RUN: llc < %s -disable-wasm-fallthrough-return-opt -disable-block-placement -verify-machineinstrs -fast-isel=false -machine-sink-split-probability-threshold=0 -cgp-freq-ratio-to-skip-merge=1000 -wasm-enable-eh -wasm-use-legacy-eh -exception-model=wasm -mattr=+exception-handling,bulk-memory -; RUN: llc < %s -O0 -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -verify-machineinstrs -wasm-enable-eh -wasm-use-legacy-eh -exception-model=wasm -mattr=+exception-handling,-bulk-memory,-bulk-memory-opt | FileCheck %s --check-prefix=NOOPT -; RUN: llc < %s -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -disa... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/224313 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
