[llvm] [WinEH] Emit state stores before SEH scopes (PR #116546)
Maurice Heumann via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 17 07:17:30 PST 2024
https://github.com/momo5502 updated https://github.com/llvm/llvm-project/pull/116546
>From 6ede329985d56c3a66f9ea4042c714849a00cf41 Mon Sep 17 00:00:00 2001
From: momo5502 <mauriceheumann at gmail.com>
Date: Sun, 17 Nov 2024 15:52:01 +0100
Subject: [PATCH] [WinEH] Emit state stores before SEH scopes
---
llvm/lib/Target/X86/X86WinEHState.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index ef212736730114..e6aad3fa2a4fb1 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -604,8 +604,18 @@ static int getSuccState(DenseMap<BasicBlock *, int> &InitialStates, Function &F,
return CommonState;
}
+static bool isSehScopeBegin(const CallBase &Call) {
+ const Function *CF = Call.getCalledFunction();
+ return CF && CF->isIntrinsic() &&
+ CF->getIntrinsicID() == Intrinsic::seh_scope_begin;
+}
+
bool WinEHStatePass::isStateStoreNeeded(EHPersonality Personality,
CallBase &Call) {
+ if (isSehScopeBegin(Call)) {
+ return true;
+ }
+
// If the function touches memory, it needs a state store.
if (isAsynchronousEHPersonality(Personality))
return !Call.doesNotAccessMemory();
More information about the llvm-commits
mailing list