[llvm] r342987 - [ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 08:30:47 PDT 2018


Author: niravd
Date: Tue Sep 25 08:30:47 2018
New Revision: 342987

URL: http://llvm.org/viewvc/llvm-project?rev=342987&view=rev
Log:
[ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.

Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=342987&r1=342986&r2=342987&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 25 08:30:47 2018
@@ -11606,8 +11606,15 @@ static SDValue CombineBaseUpdate(SDNode
       continue;
 
     // Check that the add is independent of the load/store.  Otherwise, folding
-    // it would create a cycle.
-    if (User->isPredecessorOf(N) || N->isPredecessorOf(User))
+    // it would create a cycle. We can avoid searching through Addr as it's a
+    // predecessor to both.
+    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.




More information about the llvm-commits mailing list