Skip to content

Commit 6ede329

Browse files
committed
[WinEH] Emit state stores before SEH scopes
1 parent 4f48a81 commit 6ede329

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/Target/X86/X86WinEHState.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,18 @@ static int getSuccState(DenseMap<BasicBlock *, int> &InitialStates, Function &F,
604604
return CommonState;
605605
}
606606

607+
static bool isSehScopeBegin(const CallBase &Call) {
608+
const Function *CF = Call.getCalledFunction();
609+
return CF && CF->isIntrinsic() &&
610+
CF->getIntrinsicID() == Intrinsic::seh_scope_begin;
611+
}
612+
607613
bool WinEHStatePass::isStateStoreNeeded(EHPersonality Personality,
608614
CallBase &Call) {
615+
if (isSehScopeBegin(Call)) {
616+
return true;
617+
}
618+
609619
// If the function touches memory, it needs a state store.
610620
if (isAsynchronousEHPersonality(Personality))
611621
return !Call.doesNotAccessMemory();

0 commit comments

Comments
 (0)