[llvm] [ARM] Fix -mno-omit-leaf-frame-pointer flag doesn't works on 32-bit ARM (PR #109628)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 16:45:18 PDT 2024


================
@@ -40,6 +40,20 @@ bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
   llvm_unreachable("unknown frame pointer flag");
 }
 
+/// DisableLeafFramePointerElim - This returns true if leaf frame pointer
+/// elimination optimization should be disabled for the given machine function.
+bool TargetOptions::DisableLeafFramePointerElim(
----------------
efriedma-quic wrote:

Actually, hmm.  I guess the way this works on ARM specifically is that we have a state between "non-leaf" and "leaf": basically, we have a frame pointer if we spill any registers.  (Or a few other obscure reasons which are mostly irrelevant outside of M-class targets.)  And currently, the ARM target translates "leaf" to this.

I think the best thing to do would be to get rid of ARMFrameLowering::keepFramePointer(), and add the useFastISel() check to ARMFrameLowering::hasFP() instead.  That should preserve the behavior we want here, I think.

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


More information about the llvm-commits mailing list