[llvm] [WebAssembly] Define local sp if `llvm.stacksave` is used (PR #68133)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 14:33:21 PDT 2023


================
@@ -130,7 +130,15 @@ bool WebAssemblyFrameLowering::hasReservedCallFrame(
 bool WebAssemblyFrameLowering::needsSPForLocalFrame(
     const MachineFunction &MF) const {
   auto &MFI = MF.getFrameInfo();
-  return MFI.getStackSize() || MFI.adjustsStack() || hasFP(MF);
+  auto &MRI = MF.getRegInfo();
+  // llvm.stacksave can explicitly read SP register and it can appear without
+  // dynamic alloca.
+  bool hasExplicitSPUse =
----------------
dschuff wrote:

LLVM style calls for variables to start with a capital, i.e. `HasExplicitSPUse`

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


More information about the llvm-commits mailing list