[llvm] [SDAG] Fix llvm.modf for ppc_fp128 (attempt two) (PR #127976)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 02:23:15 PST 2025
================
@@ -2644,8 +2644,10 @@ bool SelectionDAG::expandMultipleResultFPLibCall(
// optimized out. This prevents an FP stack pop from being emitted for it.
// Setting the root like this ensures there will be a use of the
// `CopyFromReg` chain, and ensures the FP pop will be emitted.
+ SDValue OldRoot = getRoot();
SDValue NewRoot =
- getNode(ISD::TokenFactor, DL, MVT::Other, getRoot(), CallChain);
+ OldRoot ? getNode(ISD::TokenFactor, DL, MVT::Other, OldRoot, CallChain)
----------------
MacDue wrote:
Ugh, it's because of:
https://github.com/llvm/llvm-project/blob/dc326d0b01f63e49f4f11c0c332369bf109721df/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp#L209-L211
Which then later ignores any changes to the root:
https://github.com/llvm/llvm-project/blob/dc326d0b01f63e49f4f11c0c332369bf109721df/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp#L438-L439
Which I think would be incorrect for the workround the multiple-result expansions are doing.
https://github.com/llvm/llvm-project/pull/127976
More information about the llvm-commits
mailing list