]> granicus.if.org Git - llvm/commitdiff
Revert "CVP: Make CVP iterate in an order that maximizes reuse of LVI cache"
authorDaniel Berlin <dberlin@dberlin.org>
Wed, 8 Feb 2017 02:48:25 +0000 (02:48 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Wed, 8 Feb 2017 02:48:25 +0000 (02:48 +0000)
This reverts commit r294398, it seems to be failing on the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294399 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

index f623b81df3a95a34278afcc58371b77dfd51a7d3..60786a3373feb4683c055983c68d04cee40978de 100644 (file)
@@ -481,11 +481,12 @@ static Constant *getConstantAt(Value *V, Instruction *At, LazyValueInfo *LVI) {
 static bool runImpl(Function &F, LazyValueInfo *LVI) {
   bool FnChanged = false;
 
-  // Visiting in an inverse depth first traversal maximizes reuse of the LVI
-  // cache, as it currently iterates in depth first order upwards, caching
-  // overdefined info as it goes.
-
-  for (BasicBlock *BB : inverse_depth_first(&F.getEntryBlock())) {
+  // Visiting in a pre-order depth-first traversal causes us to simplify early
+  // blocks before querying later blocks (which require us to analyze early
+  // blocks).  Eagerly simplifying shallow blocks means there is strictly less
+  // work to do for deep blocks.  This also means we don't visit unreachable
+  // blocks. 
+  for (BasicBlock *BB : depth_first(&F.getEntryBlock())) {
     bool BBChanged = false;
     for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
       Instruction *II = &*BI++;