diff options
| author | Nirav Dave <niravd@google.com> | 2019-03-29 20:26:23 +0000 | 
|---|---|---|
| committer | Nirav Dave <niravd@google.com> | 2019-03-29 20:26:23 +0000 | 
| commit | 54f7118de5b9bd7d1b2a4b5ba1e9662c22104d91 (patch) | |
| tree | d04823edd40f639cdf93ffe1a64cbb26a3485452 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
| parent | 09cca5b243d0fe1302f73ff158a02dcd1d316f2e (diff) | |
| download | bcm5719-llvm-54f7118de5b9bd7d1b2a4b5ba1e9662c22104d91.tar.gz bcm5719-llvm-54f7118de5b9bd7d1b2a4b5ba1e9662c22104d91.zip | |
[DAGCombiner] Rewrite ImproveLifetimeNodeChain to avoid DAG loop.
Avoid EXPENSIVE_CHECK failure. NFCI.
llvm-svn: 357309
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 13e1e96cc92..2442d20b5ca 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -15709,14 +15709,15 @@ SDValue DAGCombiner::ImproveLifetimeNodeChain(SDNode *N) {    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();  } | 

