[llvm] [AArch64] Fix stack probing clobbering flags (PR #81879)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 10:06:42 PST 2024


================
@@ -1058,9 +1058,14 @@ bool AArch64FrameLowering::canUseAsPrologue(
       return false;
   }
 
+  // Certain stack probing sequences might clobber flags, then we can't use
+  // the block as a prologue if the flags register is a live-in.
+  if (TLI->hasInlineStackProbe(*MF) && MBB.isLiveIn(AArch64::NZCV))
----------------
efriedma-quic wrote:

hasStackProbing() is probably better... although I'm not sure it actually has a visible impact.  (I think we don't shrink-wrap on targets where the difference matters.)

I'm a little concerned about other stuff in the prologue somehow clobbering the flags, although I don't have any specific example.

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


More information about the llvm-commits mailing list