[llvm] 9cc2e03 - CodeGen: Read the exception model from the module flag in EH lowering (#223970)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 16 11:15:52 PDT 2026
Author: Matt Arsenault
Date: 2026-09-16T20:15:47+02:00
New Revision: 9cc2e03045417d4a2cf53385c58da724604e673e
URL: https://github.com/llvm/llvm-project/commit/9cc2e03045417d4a2cf53385c58da724604e673e
DIFF: https://github.com/llvm/llvm-project/commit/9cc2e03045417d4a2cf53385c58da724604e673e.diff
LOG: CodeGen: Read the exception model from the module flag in EH lowering (#223970)
Resolve the exception model as the exception-model module flag if
present, otherwise the TargetOptions default.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
Added:
Modified:
llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/MachineBasicBlock.cpp
llvm/lib/CodeGen/MachineLICM.cpp
llvm/lib/CodeGen/RDFGraph.cpp
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
llvm/lib/Target/XCore/XCoreFrameLowering.cpp
llvm/test/CodeGen/WebAssembly/function-bitcasts.ll
llvm/test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll
llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll
llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll
llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
llvm/test/CodeGen/WebAssembly/lower-em-exceptions-allowed.ll
llvm/test/CodeGen/WebAssembly/lower-em-exceptions-resume-only.ll
llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
index bc7c4deef1bb1..9cd28ef7643fb 100644
--- a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
+++ b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
@@ -25,6 +25,7 @@
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/CodeGen.h"
#include "llvm/Support/KnownBits.h"
#include <cassert>
#include <utility>
@@ -187,6 +188,9 @@ class FunctionLoweringInfo {
/// SelectionDAGISel::PrepareEHLandingPad().
Register ExceptionPointerVirtReg, ExceptionSelectorVirtReg;
+ /// The exception model in effect, resolved once per function.
+ ExceptionHandling ExceptionModel = ExceptionHandling::Default;
+
/// The current call site index being processed, if any. 0 if none.
unsigned CurCallSite = 0;
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 05d2b4815dcf0..de888764904bc 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -70,6 +70,7 @@
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
@@ -3944,10 +3945,10 @@ bool IRTranslatorImpl::translateLandingPad(const User &U,
// If there aren't registers to copy the values into (e.g., during SjLj
// exceptions), then don't bother.
const Constant *PersonalityFn = MF->getFunction().getPersonalityFn();
- if (TLI->getExceptionPointerRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn) == 0 &&
- TLI->getExceptionSelectorRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn) == 0)
+ if (TLI->getExceptionPointerRegister(FuncInfo.ExceptionModel,
+ PersonalityFn) == 0 &&
+ TLI->getExceptionSelectorRegister(FuncInfo.ExceptionModel,
+ PersonalityFn) == 0)
return true;
// If landingpad's return type is token type, we don't create DAG nodes
@@ -3978,8 +3979,8 @@ bool IRTranslatorImpl::translateLandingPad(const User &U,
assert(Tys.size() == 2 && "Only two-valued landingpads are supported");
// Mark exception register as live in.
- Register ExceptionReg = TLI->getExceptionPointerRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn);
+ Register ExceptionReg =
+ TLI->getExceptionPointerRegister(FuncInfo.ExceptionModel, PersonalityFn);
if (!ExceptionReg)
return false;
@@ -3987,8 +3988,8 @@ bool IRTranslatorImpl::translateLandingPad(const User &U,
ArrayRef<Register> ResRegs = getOrCreateVRegs(LP);
MIRBuilder.buildCopy(ResRegs[0], ExceptionReg);
- Register SelectorReg = TLI->getExceptionSelectorRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn);
+ Register SelectorReg =
+ TLI->getExceptionSelectorRegister(FuncInfo.ExceptionModel, PersonalityFn);
if (!SelectorReg)
return false;
@@ -5035,6 +5036,10 @@ bool IRTranslatorImpl::runOnMachineFunction(
const TargetMachine &TM = MF->getTarget();
EnableOpts = OptLevel != CodeGenOptLevel::None && !ShouldSkipOpts;
FuncInfo.MF = MF;
+ // Prefer the "exception-model" module flag, else the TargetOptions default.
+ FuncInfo.ExceptionModel = F.getParent()->getExceptionModel();
+ if (FuncInfo.ExceptionModel == ExceptionHandling::Default)
+ FuncInfo.ExceptionModel = TM.getExceptionModel();
if (EnableOpts) {
AA = GetAAResults();
FuncInfo.BPI = GetBPI();
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index fe9f9a52c3d7b..39c286f7d3510 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -31,6 +31,7 @@
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -1836,10 +1837,12 @@ MachineBasicBlock::liveout_iterator MachineBasicBlock::liveout_begin() const {
MCRegister ExceptionPointer, ExceptionSelector;
if (MF.getFunction().hasPersonalityFn()) {
auto PersonalityFn = MF.getFunction().getPersonalityFn();
- ExceptionPointer = TLI.getExceptionPointerRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn);
- ExceptionSelector = TLI.getExceptionSelectorRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn);
+ // Prefer the "exception-model" module flag, else the TargetOptions default.
+ ExceptionHandling EH = MF.getFunction().getParent()->getExceptionModel();
+ if (EH == ExceptionHandling::Default)
+ EH = TLI.getTargetMachine().getExceptionModel();
+ ExceptionPointer = TLI.getExceptionPointerRegister(EH, PersonalityFn);
+ ExceptionSelector = TLI.getExceptionSelectorRegister(EH, PersonalityFn);
}
return liveout_iterator(*this, ExceptionPointer, ExceptionSelector, false);
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 6435bbb9382c1..50b4856d30d77 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -42,6 +42,7 @@
#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegister.h"
@@ -635,12 +636,15 @@ void MachineLICMImpl::HoistRegionPostRA(MachineLoop *CurLoop) {
const MachineFunction &MF = *BB->getParent();
const Constant *PersonalityFn = MF.getFunction().getPersonalityFn();
const TargetLowering &TLI = *MF.getSubtarget().getTargetLowering();
- if (MCRegister Reg = TLI.getExceptionPointerRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn))
+ // Prefer the "exception-model" module flag, else the TargetOptions
+ // default.
+ ExceptionHandling EH = MF.getFunction().getParent()->getExceptionModel();
+ if (EH == ExceptionHandling::Default)
+ EH = TLI.getTargetMachine().getExceptionModel();
+ if (MCRegister Reg = TLI.getExceptionPointerRegister(EH, PersonalityFn))
for (MCRegUnit Unit : TRI->regunits(Reg))
RUClobbers.set(static_cast<unsigned>(Unit));
- if (MCRegister Reg = TLI.getExceptionSelectorRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn))
+ if (MCRegister Reg = TLI.getExceptionSelectorRegister(EH, PersonalityFn))
for (MCRegUnit Unit : TRI->regunits(Reg))
RUClobbers.set(static_cast<unsigned>(Unit));
}
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index e11596edbc523..b6dddfe663539 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -25,6 +25,7 @@
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Function.h"
+#include "llvm/IR/Module.h"
#include "llvm/MC/LaneBitmask.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/ErrorHandling.h"
@@ -745,12 +746,14 @@ RegisterAggr DataFlowGraph::getLandingPadLiveIns() const {
const Function &F = MF.getFunction();
const Constant *PF = F.hasPersonalityFn() ? F.getPersonalityFn() : nullptr;
const TargetLowering &TLI = *MF.getSubtarget().getTargetLowering();
- if (RegisterId R = TLI.getExceptionPointerRegister(
- TLI.getTargetMachine().getExceptionModel(), PF))
+ // Prefer the "exception-model" module flag, else the TargetOptions default.
+ ExceptionHandling EH = F.getParent()->getExceptionModel();
+ if (EH == ExceptionHandling::Default)
+ EH = TLI.getTargetMachine().getExceptionModel();
+ if (RegisterId R = TLI.getExceptionPointerRegister(EH, PF))
LR.insert(RegisterRef(R));
if (!isFuncletEHPersonality(classifyEHPersonality(PF))) {
- if (RegisterId R = TLI.getExceptionSelectorRegister(
- TLI.getTargetMachine().getExceptionModel(), PF))
+ if (RegisterId R = TLI.getExceptionSelectorRegister(EH, PF))
LR.insert(RegisterRef(R));
}
return LR;
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 6ca0592644a08..1a2f6dd1bf4e4 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -32,9 +32,11 @@
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetMachine.h"
#include <algorithm>
using namespace llvm;
@@ -91,6 +93,10 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
RegInfo = &MF->getRegInfo();
const TargetFrameLowering *TFI = MF->getSubtarget().getFrameLowering();
UA = DAG->getUniformityInfo();
+ // Prefer the "exception-model" module flag, else the TargetOptions default.
+ ExceptionModel = Fn->getParent()->getExceptionModel();
+ if (ExceptionModel == ExceptionHandling::Default)
+ ExceptionModel = MF->getTarget().getExceptionModel();
// Check whether the function can return without sret-demotion.
SmallVector<ISD::OutputArg, 4> Outs;
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 7508e130f6d55..5443d35453d62 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3639,10 +3639,10 @@ void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &LP) {
// exceptions), then don't bother to create these DAG nodes.
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
const Constant *PersonalityFn = FuncInfo.Fn->getPersonalityFn();
- if (TLI.getExceptionPointerRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn) == 0 &&
- TLI.getExceptionSelectorRegister(
- TLI.getTargetMachine().getExceptionModel(), PersonalityFn) == 0)
+ if (TLI.getExceptionPointerRegister(FuncInfo.ExceptionModel, PersonalityFn) ==
+ 0 &&
+ TLI.getExceptionSelectorRegister(FuncInfo.ExceptionModel,
+ PersonalityFn) == 0)
return;
// If landingpad's return type is token type, we don't create DAG nodes
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 6233cf8d0d668..59a1f885d4eea 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1449,7 +1449,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
// Get or create the virtual register to hold the pointer or code. Mark
// the live in physreg and copy into the vreg.
MCRegister EHPhysReg = TLI->getExceptionPointerRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn);
+ FuncInfo->ExceptionModel, PersonalityFn);
assert(EHPhysReg && "target lacks exception pointer register");
MBB->addLiveIn(EHPhysReg);
Register VReg = FuncInfo->getCatchPadExceptionPointerVReg(CPI, PtrRC);
@@ -1483,11 +1483,11 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]);
// Mark exception register as live in.
if (MCRegister Reg = TLI->getExceptionPointerRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn))
+ FuncInfo->ExceptionModel, PersonalityFn))
FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC);
// Mark exception selector register as live in.
if (MCRegister Reg = TLI->getExceptionSelectorRegister(
- TLI->getTargetMachine().getExceptionModel(), PersonalityFn))
+ FuncInfo->ExceptionModel, PersonalityFn))
FuncInfo->ExceptionSelectorVirtReg = MBB->addLiveIn(Reg, PtrRC);
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index eb58ff53bee4b..de43564c3f2c5 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -928,6 +928,11 @@ static void nullifySetjmp(Function *F) {
bool WebAssemblyLowerEmscriptenEHSjLjImpl::runOnModule(Module &M) {
LLVM_DEBUG(dbgs() << "********** Lower Emscripten EH & SjLj **********\n");
+ // The Emscripten EH model may come from the "exception-model" module flag
+ // (e.g. when this pass is run standalone via opt) in addition to being
+ // threaded in from the TargetMachine.
+ EnableEmEH |= M.getExceptionModel() == ExceptionHandling::Emscripten;
+
LLVMContext &C = M.getContext();
IRBuilder<> IRB(C);
diff --git a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
index 78d9ae628c1f2..42f1f3f965dac 100644
--- a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
+++ b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
@@ -23,6 +23,7 @@
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/Function.h"
+#include "llvm/IR/Module.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
@@ -156,11 +157,14 @@ static void GetSpillList(SmallVectorImpl<StackSlotInfo> &SpillList,
/// As offsets are negative, the largest offsets will be first.
static void GetEHSpillList(SmallVectorImpl<StackSlotInfo> &SpillList,
MachineFrameInfo &MFI, XCoreFunctionInfo *XFI,
- const Constant *PersonalityFn,
+ const Module &M, const Constant *PersonalityFn,
const TargetLowering *TL) {
assert(XFI->hasEHSpillSlot() && "There are no EH register spill slots");
const int *EHSlot = XFI->getEHSpillSlot();
- ExceptionHandling EH = TL->getTargetMachine().getExceptionModel();
+ // Prefer the "exception-model" module flag, else the TargetOptions default.
+ ExceptionHandling EH = M.getExceptionModel();
+ if (EH == ExceptionHandling::Default)
+ EH = TL->getTargetMachine().getExceptionModel();
SpillList.push_back(
StackSlotInfo(EHSlot[0], MFI.getObjectOffset(EHSlot[0]),
TL->getExceptionPointerRegister(EH, PersonalityFn)));
@@ -323,7 +327,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
const Constant *PersonalityFn =
Fn->hasPersonalityFn() ? Fn->getPersonalityFn() : nullptr;
SmallVector<StackSlotInfo, 2> SpillList;
- GetEHSpillList(SpillList, MFI, XFI, PersonalityFn,
+ GetEHSpillList(SpillList, MFI, XFI, *Fn->getParent(), PersonalityFn,
MF.getSubtarget().getTargetLowering());
assert(SpillList.size()==2 && "Unexpected SpillList size");
EmitCfiOffset(MBB, MBBI, dl, TII,
@@ -358,7 +362,7 @@ void XCoreFrameLowering::emitEpilogue(MachineFunction &MF,
const Constant *PersonalityFn =
Fn->hasPersonalityFn() ? Fn->getPersonalityFn() : nullptr;
SmallVector<StackSlotInfo, 2> SpillList;
- GetEHSpillList(SpillList, MFI, XFI, PersonalityFn,
+ GetEHSpillList(SpillList, MFI, XFI, *Fn->getParent(), PersonalityFn,
MF.getSubtarget().getTargetLowering());
RestoreSpillList(MBB, MBBI, dl, TII, RemainingAdj, SpillList);
diff --git a/llvm/test/CodeGen/WebAssembly/function-bitcasts.ll b/llvm/test/CodeGen/WebAssembly/function-bitcasts.ll
index c623e7287c034..04c10f3362d6d 100644
--- a/llvm/test/CodeGen/WebAssembly/function-bitcasts.ll
+++ b/llvm/test/CodeGen/WebAssembly/function-bitcasts.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -enable-emscripten-cxx-exceptions | FileCheck %s
+; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -exception-model=emscripten | FileCheck %s
; Test that function pointer casts are replaced with wrappers.
diff --git a/llvm/test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll b/llvm/test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll
index 8fe32d66a2c55..2d29e6d2302f0 100644
--- a/llvm/test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll
+++ b/llvm/test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement -wasm-disable-explicit-locals -wasm-keep-registers -enable-emscripten-cxx-exceptions | FileCheck %s
+; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement -wasm-disable-explicit-locals -wasm-keep-registers -exception-model=emscripten | FileCheck %s
target triple = "wasm32-unknown-unknown"
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll
index ae7ad64ffe57c..74af281dbbb0c 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-multi-return.ll
@@ -1,4 +1,4 @@
-; RUN: not --crash llc < %s -enable-emscripten-cxx-exceptions -mattr=+multivalue -target-abi=experimental-mv 2>&1 | FileCheck %s --check-prefix=EH
+; RUN: not --crash llc < %s -exception-model=emscripten -mattr=+multivalue -target-abi=experimental-mv 2>&1 | FileCheck %s --check-prefix=EH
; RUN: not --crash llc < %s -enable-emscripten-sjlj -mattr=+multivalue -target-abi=experimental-mv 2>&1 | FileCheck %s --check-prefix=SJLJ
; Currently multivalue returning functions are not supported in Emscripten EH /
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll
index d33b27ef7f327..a59c21dc6e00e 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -enable-emscripten-cxx-exceptions | FileCheck %s --check-prefix=EH
+; RUN: llc < %s -exception-model=emscripten | FileCheck %s --check-prefix=EH
; RUN: llc < %s -enable-emscripten-sjlj | FileCheck %s --check-prefix=SJLJ
; RUN: llc < %s | FileCheck %s --check-prefix=NONE
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
index 7a04bbc3909fc..7d37f388b0bed 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -enable-emscripten-sjlj -S | FileCheck %s
-; RUN: llc < %s -enable-emscripten-cxx-exceptions -enable-emscripten-sjlj -verify-machineinstrs
+; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-sjlj -S | FileCheck %s
+; RUN: llc < %s -exception-model=emscripten -enable-emscripten-sjlj -verify-machineinstrs
; Tests for cases when exception handling and setjmp/longjmp handling are mixed.
@@ -270,3 +270,6 @@ declare ptr @__cxa_allocate_exception(i32)
attributes #0 = { returns_twice }
attributes #1 = { noreturn }
attributes #2 = { nounwind }
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"exception-model", !"emscripten"}
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-allowed.ll b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-allowed.ll
index e93d0bdd8aaa8..ff538574c3a29 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-allowed.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-allowed.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -emscripten-cxx-exceptions-allowed=do_catch -S | FileCheck %s
-; RUN: opt < %s -passes=wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -emscripten-cxx-exceptions-allowed=do_catch -S | FileCheck %s
+; RUN: opt < %s -wasm-lower-em-ehsjlj -emscripten-cxx-exceptions-allowed=do_catch -S | FileCheck %s
+; RUN: opt < %s -passes=wasm-lower-em-ehsjlj -emscripten-cxx-exceptions-allowed=do_catch -S | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
@@ -64,3 +64,6 @@ declare void @foo()
declare i32 @__gxx_personality_v0(...)
declare ptr @__cxa_begin_catch(ptr)
declare void @__cxa_end_catch()
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"exception-model", !"emscripten"}
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-resume-only.ll b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-resume-only.ll
index fc77029cf457c..7b3993c5628ba 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-resume-only.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions-resume-only.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -S | FileCheck %s
+; RUN: opt < %s -wasm-lower-em-ehsjlj -S | FileCheck %s
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
@@ -15,3 +15,6 @@ entry:
}
declare i32 @__gxx_personality_v0(...)
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"exception-model", !"emscripten"}
diff --git a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
index f6b36c56c6d3d..bfa65e210e6a6 100644
--- a/llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
+++ b/llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
@@ -1,6 +1,6 @@
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -S | FileCheck %s -DPTR=i32
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -S --mattr=+atomics,+bulk-memory | FileCheck %s -DPTR=i32
-; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions --mtriple=wasm64-unknown-unknown -data-layout="e-m:e-p:64:64-i64:64-n32:64-S128" -S | FileCheck %s -DPTR=i64
+; RUN: opt < %s -wasm-lower-em-ehsjlj -S | FileCheck %s -DPTR=i32
+; RUN: opt < %s -wasm-lower-em-ehsjlj -S --mattr=+atomics,+bulk-memory | FileCheck %s -DPTR=i32
+; RUN: opt < %s -wasm-lower-em-ehsjlj --mtriple=wasm64-unknown-unknown -data-layout="e-m:e-p:64:64-i64:64-n32:64-S128" -S | FileCheck %s -DPTR=i64
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
@@ -172,3 +172,6 @@ declare void @__cxa_call_unexpected(ptr)
; CHECK-DAG: declare void @__resumeException(ptr)
; CHECK-DAG: declare void @__invoke_void_i32(ptr, i32)
; CHECK-DAG: declare ptr @__cxa_find_matching_catch_4(ptr, ptr)
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"exception-model", !"emscripten"}
More information about the llvm-commits
mailing list