summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorLucas Ramirez <11032120+lucas-rami@users.noreply.github.com>2025-07-25 04:38:20 -0700
committerAmir Ayupov <aaupov@fb.com>2025-07-25 04:38:20 -0700
commitf45382b8900a58374b1395a7dd03d7f40085faf3 (patch)
treeeddff09d0f6bff927ae0866a4c817b6aef84707b /llvm/lib/CodeGen/StackProtector.cpp
parent832d1b1c812acff0a2e01799a0a59d69ebcc7d25 (diff)
parente38f98f535f6e2ce2b42ea0413919f87b1239964 (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/aaupov/spr/main.bolt-require-cfg-in-bat-mode
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index b79911bcf3c4..2a8234a37a16 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -588,7 +588,14 @@ bool InsertStackProtectors(const TargetMachine *TM, Function *F,
continue;
Instruction *CheckLoc = dyn_cast<ReturnInst>(BB.getTerminator());
if (!CheckLoc && !DisableCheckNoReturn)
- for (auto &Inst : BB)
+ for (auto &Inst : BB) {
+ if (IntrinsicInst *IB = dyn_cast<IntrinsicInst>(&Inst);
+ IB && (IB->getIntrinsicID() == Intrinsic::eh_sjlj_callsite)) {
+ // eh_sjlj_callsite has to be in same BB as the
+ // bb terminator. Don't insert within this range.
+ CheckLoc = IB;
+ break;
+ }
if (auto *CB = dyn_cast<CallBase>(&Inst))
// Do stack check before noreturn calls that aren't nounwind (e.g:
// __cxa_throw).
@@ -596,6 +603,7 @@ bool InsertStackProtectors(const TargetMachine *TM, Function *F,
CheckLoc = CB;
break;
}
+ }
if (!CheckLoc)
continue;