-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[win] Fix EH Cont Guard targets when SEH personality is used #129612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-aarch64 @llvm/pr-subscribers-backend-hexagon Author: Daniel Paoliello (dpaoliello) ChangesThere were two issues when
In fixing these issues, I renamed the various functions, fields and pass to talk about "EHCont Targets" instead of "EHCont Guardret". This, unfortunately, resulted in a lot of churn for the MIR parser tests. Fixes #64585 Patch is 56.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/129612.diff 77 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
index dbad3469d047d..119786f045ed9 100644
--- a/llvm/include/llvm/CodeGen/MIRYamlMapping.h
+++ b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
@@ -762,7 +762,7 @@ struct MachineFunction {
bool CallsEHReturn = false;
bool CallsUnwindInit = false;
- bool HasEHCatchret = false;
+ bool HasEHContTarget = false;
bool HasEHScopes = false;
bool HasEHFunclets = false;
bool IsOutlined = false;
@@ -810,7 +810,7 @@ template <> struct MappingTraits<MachineFunction> {
YamlIO.mapOptional("callsEHReturn", MF.CallsEHReturn, false);
YamlIO.mapOptional("callsUnwindInit", MF.CallsUnwindInit, false);
- YamlIO.mapOptional("hasEHCatchret", MF.HasEHCatchret, false);
+ YamlIO.mapOptional("hasEHContTarget", MF.HasEHContTarget, false);
YamlIO.mapOptional("hasEHScopes", MF.HasEHScopes, false);
YamlIO.mapOptional("hasEHFunclets", MF.HasEHFunclets, false);
YamlIO.mapOptional("isOutlined", MF.IsOutlined, false);
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 2de96fa85b936..3ed1dee5e9abc 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -205,8 +205,8 @@ class MachineBasicBlock
/// LLVM IR.
bool IsEHScopeEntry = false;
- /// Indicates if this is a target block of a catchret.
- bool IsEHCatchretTarget = false;
+ /// Indicates if this is a target of EHCont Guard.
+ bool IsEHContTarget = false;
/// Indicate that this basic block is the entry block of an EH funclet.
bool IsEHFuncletEntry = false;
@@ -234,8 +234,8 @@ class MachineBasicBlock
/// is only computed once and is cached.
mutable MCSymbol *CachedMCSymbol = nullptr;
- /// Cached MCSymbol for this block (used if IsEHCatchRetTarget).
- mutable MCSymbol *CachedEHCatchretMCSymbol = nullptr;
+ /// Cached MCSymbol for this block (used if IsEHContTarget).
+ mutable MCSymbol *CachedEHContMCSymbol = nullptr;
/// Marks the end of the basic block. Used during basic block sections to
/// calculate the size of the basic block, or the BB section ending with it.
@@ -652,11 +652,11 @@ class MachineBasicBlock
/// that used to have a catchpad or cleanuppad instruction in the LLVM IR.
void setIsEHScopeEntry(bool V = true) { IsEHScopeEntry = V; }
- /// Returns true if this is a target block of a catchret.
- bool isEHCatchretTarget() const { return IsEHCatchretTarget; }
+ /// Returns true if this is a target of EHCont Guard.
+ bool isEHContTarget() const { return IsEHContTarget; }
- /// Indicates if this is a target block of a catchret.
- void setIsEHCatchretTarget(bool V = true) { IsEHCatchretTarget = V; }
+ /// Indicates if this is a target of EHCont Guard.
+ void setIsEHContTarget(bool V = true) { IsEHContTarget = V; }
/// Returns true if this is the entry block of an EH funclet.
bool isEHFuncletEntry() const { return IsEHFuncletEntry; }
@@ -1238,8 +1238,8 @@ class MachineBasicBlock
/// Return the MCSymbol for this basic block.
MCSymbol *getSymbol() const;
- /// Return the EHCatchret Symbol for this basic block.
- MCSymbol *getEHCatchretSymbol() const;
+ /// Return the EHCont Symbol for this basic block.
+ MCSymbol *getEHContSymbol() const;
std::optional<uint64_t> getIrrLoopHeaderWeight() const {
return IrrLoopHeaderWeight;
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index 408428fe28a32..c33d822990558 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -359,9 +359,8 @@ class LLVM_ABI MachineFunction {
/// construct a table of valid longjmp targets for Windows Control Flow Guard.
std::vector<MCSymbol *> LongjmpTargets;
- /// List of basic blocks that are the target of catchrets. Used to construct
- /// a table of valid targets for Windows EHCont Guard.
- std::vector<MCSymbol *> CatchretTargets;
+ /// List of basic blocks that are the targets for Windows EHCont Guard.
+ std::vector<MCSymbol *> EHContTargets;
/// \name Exception Handling
/// \{
@@ -383,7 +382,7 @@ class LLVM_ABI MachineFunction {
bool CallsEHReturn = false;
bool CallsUnwindInit = false;
- bool HasEHCatchret = false;
+ bool HasEHContTarget = false;
bool HasEHScopes = false;
bool HasEHFunclets = false;
bool HasFakeUses = false;
@@ -1197,16 +1196,15 @@ class LLVM_ABI MachineFunction {
/// Control Flow Guard.
void addLongjmpTarget(MCSymbol *Target) { LongjmpTargets.push_back(Target); }
- /// Returns a reference to a list of symbols that we have catchrets.
- /// Used to construct the catchret target table used by Windows EHCont Guard.
- const std::vector<MCSymbol *> &getCatchretTargets() const {
- return CatchretTargets;
+ /// Returns a reference to a list of symbols that are targets for Windows
+ /// EHCont Guard.
+ const std::vector<MCSymbol *> &getEHContTargets() const {
+ return EHContTargets;
}
- /// Add the specified symbol to the list of valid catchret targets for Windows
- /// EHCont Guard.
- void addCatchretTarget(MCSymbol *Target) {
- CatchretTargets.push_back(Target);
+ /// Add the specified symbol to the list of targets for Windows EHCont Guard.
+ void addEHContTarget(MCSymbol *Target) {
+ EHContTargets.push_back(Target);
}
/// Tries to get the global and target flags for a call site, if the
@@ -1236,8 +1234,8 @@ class LLVM_ABI MachineFunction {
bool callsUnwindInit() const { return CallsUnwindInit; }
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
- bool hasEHCatchret() const { return HasEHCatchret; }
- void setHasEHCatchret(bool V) { HasEHCatchret = V; }
+ bool hasEHContTarget() const { return HasEHContTarget; }
+ void setHasEHContTarget(bool V) { HasEHContTarget = V; }
bool hasEHScopes() const { return HasEHScopes; }
void setHasEHScopes(bool V) { HasEHScopes = V; }
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 5fa67a29ddbb6..860791086ca9a 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -550,9 +550,9 @@ namespace llvm {
/// \see CFGuardLongjmp.cpp
FunctionPass *createCFGuardLongjmpPass();
- /// Creates EHContGuard catchret target identification pass.
- /// \see EHContGuardCatchret.cpp
- FunctionPass *createEHContGuardCatchretPass();
+ /// Creates EHContGuard target identification pass.
+ /// \see EHContGuardTargets.cpp
+ FunctionPass *createEHContGuardTargetsPass();
/// Create Hardware Loop pass. \see HardwareLoops.cpp
FunctionPass *createHardwareLoopsLegacyPass();
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 53362bb0a1a11..fb6c7c8ffb679 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -104,7 +104,7 @@ void initializeEarlyIfPredicatorPass(PassRegistry &);
void initializeEarlyMachineLICMPass(PassRegistry &);
void initializeEarlyTailDuplicateLegacyPass(PassRegistry &);
void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &);
-void initializeEHContGuardCatchretPass(PassRegistry &);
+void initializeEHContGuardTargetsPass(PassRegistry &);
void initializeExpandLargeFpConvertLegacyPassPass(PassRegistry &);
void initializeExpandLargeDivRemLegacyPassPass(PassRegistry &);
void initializeExpandMemCmpLegacyPassPass(PassRegistry &);
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 6f39bff80abda..6d99cb3a516cc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -4288,9 +4288,9 @@ void AsmPrinter::emitBasicBlockStart(const MachineBasicBlock &MBB) {
}
}
- if (MBB.isEHCatchretTarget() &&
+ if (MBB.isEHContTarget() &&
MAI->getExceptionHandlingType() == ExceptionHandling::WinEH) {
- OutStreamer->emitLabel(MBB.getEHCatchretSymbol());
+ OutStreamer->emitLabel(MBB.getEHContSymbol());
}
// With BB sections, each basic block must handle CFI information on its own
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 97b4a6a42d81d..db9ce904e6127 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -160,10 +160,10 @@ void WinException::endFunction(const MachineFunction *MF) {
Asm->OutStreamer->popSection();
}
- if (!MF->getCatchretTargets().empty()) {
- // Copy the function's catchret targets to a module-level list.
- EHContTargets.insert(EHContTargets.end(), MF->getCatchretTargets().begin(),
- MF->getCatchretTargets().end());
+ if (!MF->getEHContTargets().empty()) {
+ // Copy the function's ehcont targets to a module-level list.
+ EHContTargets.insert(EHContTargets.end(), MF->getEHContTargets().begin(),
+ MF->getEHContTargets().end());
}
}
@@ -290,6 +290,12 @@ void WinException::endFuncletImpl() {
// functions that need it in the end anyway.
}
+ if (!MF->getEHContTargets().empty()) {
+ // Copy the function's ehcont targets to a module-level list.
+ EHContTargets.insert(EHContTargets.end(), MF->getEHContTargets().begin(),
+ MF->getEHContTargets().end());
+ }
+
// Switch back to the funclet start .text section now that we are done
// writing to .xdata, and emit an .seh_endproc directive to mark the end of
// the function.
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 23ec3310079d3..0c92637a75e77 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -54,7 +54,7 @@ add_llvm_component_library(LLVMCodeGen
DwarfEHPrepare.cpp
EarlyIfConversion.cpp
EdgeBundles.cpp
- EHContGuardCatchret.cpp
+ EHContGuardTargets.cpp
ExecutionDomainFix.cpp
ExpandLargeDivRem.cpp
ExpandLargeFpConvert.cpp
diff --git a/llvm/lib/CodeGen/EHContGuardCatchret.cpp b/llvm/lib/CodeGen/EHContGuardTargets.cpp
similarity index 60%
rename from llvm/lib/CodeGen/EHContGuardCatchret.cpp
rename to llvm/lib/CodeGen/EHContGuardTargets.cpp
index cd1cdb0653618..9cac6fd62c644 100644
--- a/llvm/lib/CodeGen/EHContGuardCatchret.cpp
+++ b/llvm/lib/CodeGen/EHContGuardTargets.cpp
@@ -1,4 +1,4 @@
-//===-- EHContGuardCatchret.cpp - Catchret target symbols -------*- C++ -*-===//
+//===-- EHContGuardTargets.cpp - EH Cont target symbols ---------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,8 +8,8 @@
///
/// \file
/// This file contains a machine function pass to insert a symbol before each
-/// valid catchret target and store this in the MachineFunction's
-/// CatchRetTargets vector. This will be used to emit the table of valid targets
+/// valid EH Cont target and store this in the MachineFunction's
+/// EHContTargets vector. This will be used to emit the table of valid targets
/// used by EHCont Guard.
///
//===----------------------------------------------------------------------===//
@@ -26,19 +26,19 @@ using namespace llvm;
#define DEBUG_TYPE "ehcontguard-catchret"
-STATISTIC(EHContGuardCatchretTargets,
- "Number of EHCont Guard catchret targets");
+STATISTIC(EHContGuardTargetsFound,
+ "Number of EHCont Guard targets");
namespace {
/// MachineFunction pass to insert a symbol before each valid catchret target
/// and store these in the MachineFunction's CatchRetTargets vector.
-class EHContGuardCatchret : public MachineFunctionPass {
+class EHContGuardTargets : public MachineFunctionPass {
public:
static char ID;
- EHContGuardCatchret() : MachineFunctionPass(ID) {
- initializeEHContGuardCatchretPass(*PassRegistry::getPassRegistry());
+ EHContGuardTargets() : MachineFunctionPass(ID) {
+ initializeEHContGuardTargetsPass(*PassRegistry::getPassRegistry());
}
StringRef getPassName() const override {
@@ -50,31 +50,31 @@ class EHContGuardCatchret : public MachineFunctionPass {
} // end anonymous namespace
-char EHContGuardCatchret::ID = 0;
+char EHContGuardTargets::ID = 0;
-INITIALIZE_PASS(EHContGuardCatchret, "EHContGuardCatchret",
- "Insert symbols at valid catchret targets for /guard:ehcont",
+INITIALIZE_PASS(EHContGuardTargets, "EHContGuardTargets",
+ "Insert symbols at valid targets for /guard:ehcont",
false, false)
-FunctionPass *llvm::createEHContGuardCatchretPass() {
- return new EHContGuardCatchret();
+FunctionPass *llvm::createEHContGuardTargetsPass() {
+ return new EHContGuardTargets();
}
-bool EHContGuardCatchret::runOnMachineFunction(MachineFunction &MF) {
+bool EHContGuardTargets::runOnMachineFunction(MachineFunction &MF) {
// Skip modules for which the ehcontguard flag is not set.
if (!MF.getFunction().getParent()->getModuleFlag("ehcontguard"))
return false;
- // Skip functions that do not have catchret
- if (!MF.hasEHCatchret())
+ // Skip functions that do not have EHCont targets
+ if (!MF.hasEHContTarget())
return false;
bool Result = false;
for (MachineBasicBlock &MBB : MF) {
- if (MBB.isEHCatchretTarget()) {
- MF.addCatchretTarget(MBB.getEHCatchretSymbol());
- EHContGuardCatchretTargets++;
+ if (MBB.isEHContTarget()) {
+ MF.addEHContTarget(MBB.getEHContSymbol());
+ EHContGuardTargetsFound++;
Result = true;
}
}
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
index 7a47a26a21615..64b7e244108a2 100644
--- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
@@ -551,7 +551,7 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
MF.setCallsEHReturn(YamlMF.CallsEHReturn);
MF.setCallsUnwindInit(YamlMF.CallsUnwindInit);
- MF.setHasEHCatchret(YamlMF.HasEHCatchret);
+ MF.setHasEHContTarget(YamlMF.HasEHContTarget);
MF.setHasEHScopes(YamlMF.HasEHScopes);
MF.setHasEHFunclets(YamlMF.HasEHFunclets);
MF.setIsOutlined(YamlMF.IsOutlined);
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 96ba475f93844..e9bd60e4e2597 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -208,7 +208,7 @@ void MIRPrinter::print(const MachineFunction &MF) {
YamlMF.CallsEHReturn = MF.callsEHReturn();
YamlMF.CallsUnwindInit = MF.callsUnwindInit();
- YamlMF.HasEHCatchret = MF.hasEHCatchret();
+ YamlMF.HasEHContTarget = MF.hasEHContTarget();
YamlMF.HasEHScopes = MF.hasEHScopes();
YamlMF.HasEHFunclets = MF.hasEHFunclets();
YamlMF.HasFakeUses = MF.hasFakeUses();
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index b3a71d1144726..fa6b53455f145 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -92,15 +92,15 @@ MCSymbol *MachineBasicBlock::getSymbol() const {
return CachedMCSymbol;
}
-MCSymbol *MachineBasicBlock::getEHCatchretSymbol() const {
- if (!CachedEHCatchretMCSymbol) {
+MCSymbol *MachineBasicBlock::getEHContSymbol() const {
+ if (!CachedEHContMCSymbol) {
const MachineFunction *MF = getParent();
SmallString<128> SymbolName;
raw_svector_ostream(SymbolName)
<< "$ehgcr_" << MF->getFunctionNumber() << '_' << getNumber();
- CachedEHCatchretMCSymbol = MF->getContext().getOrCreateSymbol(SymbolName);
+ CachedEHContMCSymbol = MF->getContext().getOrCreateSymbol(SymbolName);
}
- return CachedEHCatchretMCSymbol;
+ return CachedEHContMCSymbol;
}
MCSymbol *MachineBasicBlock::getEndSymbol() const {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 86b99a5210924..fb6626f8e6755 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1970,7 +1970,11 @@ void SelectionDAGBuilder::visitCatchPad(const CatchPadInst &I) {
bool IsCoreCLR = Pers == EHPersonality::CoreCLR;
bool IsSEH = isAsynchronousEHPersonality(Pers);
MachineBasicBlock *CatchPadMBB = FuncInfo.MBB;
- if (!IsSEH)
+ if (IsSEH) {
+ // For SEH, EHCont Guard needs to know that this catchpad is a target.
+ CatchPadMBB->setIsEHContTarget(true);
+ DAG.getMachineFunction().setHasEHContTarget(true);
+ } else
CatchPadMBB->setIsEHScopeEntry();
// In MSVC C++ and CoreCLR, catchblocks are funclets and need prologues.
if (IsMSVCCXX || IsCoreCLR)
@@ -1981,8 +1985,6 @@ void SelectionDAGBuilder::visitCatchRet(const CatchReturnInst &I) {
// Update machine-CFG edge.
MachineBasicBlock *TargetMBB = FuncInfo.getMBB(I.getSuccessor());
FuncInfo.MBB->addSuccessor(TargetMBB);
- TargetMBB->setIsEHCatchretTarget(true);
- DAG.getMachineFunction().setHasEHCatchret(true);
auto Pers = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn());
bool IsSEH = isAsynchronousEHPersonality(Pers);
@@ -1996,6 +1998,10 @@ void SelectionDAGBuilder::visitCatchRet(const CatchReturnInst &I) {
return;
}
+ // For non-SEH, EHCont Guard needs to know that this catchret is a target.
+ TargetMBB->setIsEHContTarget(true);
+ DAG.getMachineFunction().setHasEHContTarget(true);
+
// Figure out the funclet membership for the catchret's successor.
// This will be used by the FuncletLayout pass to determine how to order the
// BB's.
diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
index d10a0c0a08f89..5c514bf02968a 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -869,7 +869,7 @@ void AArch64PassConfig::addPreEmitPass() {
// Identify valid longjmp targets for Windows Control Flow Guard.
addPass(createCFGuardLongjmpPass());
// Identify valid eh continuation targets for Windows EHCont Guard.
- addPass(createEHContGuardCatchretPass());
+ addPass(createEHContGuardTargetsPass());
}
if (TM->getOptLevel() != CodeGenOptLevel::None && EnableCollectLOH &&
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index 98bdf310dea91..a0d56704305a3 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -620,7 +620,7 @@ void ARMPassConfig::addPreEmitPass2() {
// Identify valid longjmp targets for Windows Control Flow Guard.
addPass(createCFGuardLongjmpPass());
// Identify valid eh continuation targets for Windows EHCont Guard.
- addPass(createEHContGuardCatchretPass());
+ addPass(createEHContGuardTargetsPass());
}
}
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 0430279b88984..4cecbbf27aa30 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -647,7 +647,7 @@ void X86PassConfig::addPreEmitPass2() {
// Identify valid longjmp targets for Windows Control Flow Guard.
addPass(createCFGuardLongjmpPass());
// Identify valid eh continuation targets for Windows EHCont Guard.
- addPass(createEHContGuardCatchretPass());
+ addPass(createEHContGuardTargetsPass());
}
addPass(createX86LoadValueInjectionRetHardeningPass());
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/store-merging-debug.mir b/llvm/test/CodeGen/AArch64/GlobalISel/store-merging-debug.mir
index d52ef0f3da74c..2f4dbb7d47af5 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/store-merging-debug.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/store-merging-debug.mir
@@ -48,7 +48,7 @@ tracksRegLiveness: true
hasWinCFI: false
callsEHReturn: false
callsUnwindInit: false
-hasEHCatchret: false
+hasEHContTarget: false
hasEHScopes: false
hasEHFunclets: false
failsVerification: false
diff --git a/llvm/test/CodeGen/AArch64/arm64ec-eh.ll b/llvm/test/CodeGen/AArch64/arm64ec-eh.ll
index 4b6bbb01c6c2d..64c4a871647f1 100644
--- a/llvm/test/CodeGen/AArch64/arm64ec-eh.ll
+++ b/llvm/test/CodeGen/AArch64/arm64ec-eh.ll
@@ -22,7 +22,6 @@ define dso_local i32 @test() #0 personality ptr @__C_specific_handler {
; CHEC...
[truncated]
|
|
Thanks a lot for the fixing @dpaoliello !
Would it be better if we split this as an NFC patch?
Can you provide more details about the reasoning. This was implemented by @arlosi from MS. Although I reviewed it, I don't understand the difference between one way and another. |
|
@phoebewang that second part addresses the issue I pointed out here: #64585 (comment) ExceptionHandler and EHcont guard target should always be the same, because the former is the target address that will get NtContinue-d to, where filtering based on the ehcont list happens. The previous implementation never worked. |
Sure, sounds like a good idea.
I'm aware of that work: Arlo is on my team. EHCont was originally added to LLVM to handle Rust, which always uses the C++ Exception personality ( |
|
As high level feedback on the rename, I worry that "ehcont" is opaque jargon. I correctly guessed that it stands for "exception handling continuation", but I don't assume most readers will get that. LLVM definitely doesn't subscribe to the long descriptive naming philosophy, so I think it's best to split the difference and use the EHCont variable names as you have them, but please update the comments to spell out "EH continuation(s)" to help readers who aren't familiar with Windows EH tech. In some ways, these points are similar to landing pads, but we've already overloaded "pad" as a concept to include funclet entry blocks. I guess an LLVM "pad" is any basic block that can be the target of a runtime-mediated control flow transfer. |
|
I think I was in a rush so I forgot to mention, yes, this seems like a good change, thanks for doing the rename to make it consistent. :) |
|
Split out the renaming as an NFC: #129953 |
phoebewang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description needs update.
|
Thanks for getting the fix in :) |
There were two issues when
/guard:ehcontis enabled with the SEH personality on Windows:WinException::endFunctionearly forMSVC_TableSEHwith funclets, expecting the exception data to be emitted inendFunclet, butendFuncletdidn't copy the EHCont metadata from the function to the module.catchpadis the target, not thecatchret.Fixes #64585