[llvm] [SDAG] Only apply sincos/frexp stack slot folding to IR pointers (PR #115346)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 15:16:30 PST 2024


================
@@ -2518,7 +2518,12 @@ bool SelectionDAG::expandMultipleResultFPLibCall(
     SDValue StoreValue = ST->getValue();
     unsigned ResNo = StoreValue.getResNo();
     Type *StoreType = StoreValue.getValueType().getTypeForEVT(Ctx);
-    if (CallRetResNo == ResNo || !ST->isSimple() ||
+    // If the pointer value does not come from the IR, it could come from ABI
+    // lowering and may alias with the arguments of the library call if they are
+    // passed via the stack.
----------------
MacDue wrote:

>  The correct way to handle that case should involve callseq_start/callseq_end. Assuming the libcall isn't nested inside another callseq_start/end, there should be a callseq_end and a callseq_start between the libcall and the store.

It looks like this is the case. Would a potential fix be to check that a `CALLSEQ_START` does not occur in the chain of the store? 

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


More information about the llvm-commits mailing list