[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
Fri Nov 8 01:14:27 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:
Could you clarify that? Before this expansion you have an `frexp` or `fsincos` where the users are stores within the call sequence of another function (g in the previous example). There are no aliasing issues at this point. The issue occurs when the node is replaced with a library call. It takes its input chains from the previous stores, so when expanded you have a call sequence for the node nested inside a call sequence for g 😬. This is where the issues come from as both calls used the same area for stack arguments.
https://github.com/llvm/llvm-project/pull/115346
More information about the llvm-commits
mailing list