[llvm] [LFI][AArch64] Do not flush deferred LR guards on temporary labels (PR #224776)

Sharjeel Khan via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 20:08:47 PDT 2026


================
@@ -129,11 +129,10 @@ static std::optional<unsigned> getLFIInstSizeInBytes(const MachineInstr &MI) {
     // Indirect branches/calls expand to 2 instructions (guard + br/blr).
     return 8;
   case AArch64::RET:
-    // RET through LR is not rewritten, but RET through another register
-    // expands to 2 instructions (guard + ret).
-    if (MI.getOperand(0).getReg() != AArch64::LR)
-      return 8;
-    return 4;
+    // RET through another register expands to 2 instructions (guard + ret).
+    // RET through LR may also expand to 2 instructions if a deferred LR guard
+    // is flushed before the return.
+    return 8;
----------------
Sharjeel-Khan wrote:

Made a PR for this: https://github.com/llvm/llvm-project/pull/224791

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


More information about the llvm-commits mailing list