[llvm] r294399 - Revert "CVP: Make CVP iterate in an order that maximizes reuse of LVI cache"

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 18:48:25 PST 2017


Author: dannyb
Date: Tue Feb  7 20:48:25 2017
New Revision: 294399

URL: http://llvm.org/viewvc/llvm-project?rev=294399&view=rev
Log:
Revert "CVP: Make CVP iterate in an order that maximizes reuse of LVI cache"

This reverts commit r294398, it seems to be failing on the bots.

Modified:
    llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=294399&r1=294398&r2=294399&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Tue Feb  7 20:48:25 2017
@@ -481,11 +481,12 @@ static Constant *getConstantAt(Value *V,
 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++;




More information about the llvm-commits mailing list