[llvm] [AArch64][BTI] Add BTI at EH entries. (PR #155308)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 00:01:05 PDT 2025


================
@@ -100,9 +99,15 @@ bool AArch64BranchTargets::runOnMachineFunction(MachineFunction &MF) {
     // If the block itself is address-taken, it could be indirectly branched
     // to, but not called.
     if (MBB.isMachineBlockAddressTaken() || MBB.isIRBlockAddressTaken() ||
-        JumpTableTargets.count(&MBB))
+        JumpTableTargets.count(&MBB) || MBB.isEHPad())
       CouldJump = true;
 
+    if (MBB.isEHPad()) {
+      if (HasWinCFI && (MBB.isEHFuncletEntry() || MBB.isCleanupFuncletEntry()))
+        CouldCall = true;
+      else
+        CouldJump = true;
+    }
     if (CouldCall || CouldJump) {
       addBTI(MBB, CouldCall, CouldJump, HasWinCFI);
----------------
davemgreen wrote:

When we readd the part to fix the EH_LABEL location, whilst I'm not sure it will always come up, we should make sure that we handle debug instructions correctly by skipping through at isMetaInstruction instructions too.

https://github.com/llvm/llvm-project/pull/155308


More information about the llvm-commits mailing list