[llvm] r357309 - [DAGCombiner] Rewrite ImproveLifetimeNodeChain to avoid DAG loop.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 29 13:26:23 PDT 2019
Author: niravd
Date: Fri Mar 29 13:26:23 2019
New Revision: 357309
URL: http://llvm.org/viewvc/llvm-project?rev=357309&view=rev
Log:
[DAGCombiner] Rewrite ImproveLifetimeNodeChain to avoid DAG loop.
Avoid EXPENSIVE_CHECK failure. NFCI.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=357309&r1=357308&r2=357309&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Mar 29 13:26:23 2019
@@ -15709,14 +15709,15 @@ SDValue DAGCombiner::ImproveLifetimeNode
auto Chain = N->getOperand(0);
auto NewChain = FindBetterChain(N, Chain);
if (NewChain != Chain) {
- SDNode *N2 = DAG.UpdateNodeOperands(N, NewChain, N->getOperand(1));
- // Make sure users of new N still depend on Chain
- auto TF = DAG.getNode(ISD::TokenFactor, SDLoc(N2), MVT::Other, Chain,
- SDValue(N2, 0));
- DAG.ReplaceAllUsesOfValueWith(SDValue(N2, 0), TF);
- AddToWorklist(DAG.UpdateNodeOperands(TF.getNode(), Chain, SDValue(N2, 0)));
- AddToWorklist(N2);
- return SDValue(N, 0);
+ LifetimeSDNode *LN = cast<LifetimeSDNode>(N);
+ // Create New Node to prevent loop in CombineTo.
+ SDValue NewN = DAG.getLifetimeNode(N->getOpcode() == ISD::LIFETIME_START,
+ SDLoc(N), NewChain, LN->getFrameIndex(),
+ LN->hasOffset() ? LN->getSize() : -1,
+ LN->hasOffset() ? LN->getOffset() : -1);
+ AddToWorklist(NewN.getNode());
+ auto TF = DAG.getNode(ISD::TokenFactor, SDLoc(N), MVT::Other, Chain, NewN);
+ return CombineTo(N, TF);
}
return SDValue();
}
More information about the llvm-commits
mailing list