diff options
author | Nirav Dave <niravd@google.com> | 2018-09-25 15:30:22 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2018-09-25 15:30:22 +0000 |
commit | e40e2bbd3710a4a8016c76b55d675b6e4ebb5458 (patch) | |
tree | 97d9a20059aa9be2245bf142af2919aae8056757 | |
parent | a2f514d6727f86416926b4017fac268ad8b7faba (diff) | |
download | bcm5719-llvm-e40e2bbd3710a4a8016c76b55d675b6e4ebb5458.tar.gz bcm5719-llvm-e40e2bbd3710a4a8016c76b55d675b6e4ebb5458.zip |
[AArch64] Share search bookkeeping in combines. NFCI.
Share predecessor search bookkeeping in both perform PostLD1Combine
and performNEONPostLDSTCombine. This should be approximately a 4x and
2x performance improvement.
llvm-svn: 342986
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 3282d951033..8cf9d55a950 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -10175,15 +10175,6 @@ static SDValue performPostLD1Combine(SDNode *N, || UI.getUse().getResNo() != Addr.getResNo()) continue; - // Check that the add is independent of the load. Otherwise, folding it - // would create a cycle. - if (User->isPredecessorOf(LD) || LD->isPredecessorOf(User)) - continue; - // Also check that add is not used in the vector operand. This would also - // create a cycle. - if (User->isPredecessorOf(Vector.getNode())) - continue; - // If the increment is a constant, it must match the memory ref size. SDValue Inc = User->getOperand(User->getOperand(0) == Addr ? 1 : 0); if (ConstantSDNode *CInc = dyn_cast<ConstantSDNode>(Inc.getNode())) { @@ -10194,11 +10185,16 @@ static SDValue performPostLD1Combine(SDNode *N, Inc = DAG.getRegister(AArch64::XZR, MVT::i64); } - // Finally, check that the vector doesn't depend on the load. - // Again, this would create a cycle. - // The load depending on the vector is fine, as that's the case for the - // LD1*post we'll eventually generate anyway. - if (LoadSDN->isPredecessorOf(Vector.getNode())) + // To avoid cycle construction make sure that neither the load nor the add + // are predecessors to each other or the Vector. + SmallPtrSet<const SDNode *, 32> Visited; + SmallVector<const SDNode *, 16> Worklist; + Visited.insert(N); + Worklist.push_back(User); + Worklist.push_back(LD); + Worklist.push_back(Vector.getNode()); + if (SDNode::hasPredecessorHelper(LD, Visited, Worklist) || + SDNode::hasPredecessorHelper(User, Visited, Worklist)) continue; SmallVector<SDValue, 8> Ops; @@ -10284,7 +10280,13 @@ static SDValue performNEONPostLDSTCombine(SDNode *N, // Check that the add is independent of the load/store. Otherwise, folding // it would create a cycle. - if (User->isPredecessorOf(N) || N->isPredecessorOf(User)) + SmallPtrSet<const SDNode *, 32> Visited; + SmallVector<const SDNode *, 16> Worklist; + Visited.insert(Addr.getNode()); + Worklist.push_back(N); + Worklist.push_back(User); + if (SDNode::hasPredecessorHelper(N, Visited, Worklist) || + SDNode::hasPredecessorHelper(User, Visited, Worklist)) continue; // Find the new opcode for the updating load/store. |