[llvm] 886f54a - DAG: Set MachinePointerInfo for stack when expanding divrem libcall (#170537)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 07:25:23 PST 2025


Author: Matt Arsenault
Date: 2025-12-08T16:25:19+01:00
New Revision: 886f54a04c04d1b7c4649ae9d00f85cf7655269a

URL: https://github.com/llvm/llvm-project/commit/886f54a04c04d1b7c4649ae9d00f85cf7655269a
DIFF: https://github.com/llvm/llvm-project/commit/886f54a04c04d1b7c4649ae9d00f85cf7655269a.diff

LOG: DAG: Set MachinePointerInfo for stack when expanding divrem libcall (#170537)

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index c46264e09bc46..7606bc8f4a5b6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2407,8 +2407,11 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
   std::pair<SDValue, SDValue> CallInfo = TLI.LowerCallTo(CLI);
 
   // Remainder is loaded back from the stack frame.
-  SDValue Rem =
-      DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr, MachinePointerInfo());
+  int FI = cast<FrameIndexSDNode>(FIPtr)->getIndex();
+  MachinePointerInfo PtrInfo =
+      MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI);
+
+  SDValue Rem = DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr, PtrInfo);
   Results.push_back(CallInfo.first);
   Results.push_back(Rem);
 }


        


More information about the llvm-commits mailing list