From: Daniel Berlin Date: Wed, 8 Feb 2017 02:48:25 +0000 (+0000) Subject: Revert "CVP: Make CVP iterate in an order that maximizes reuse of LVI cache" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75bd1d7575dc7299dd5714588e2ca2b4d5658878;p=llvm 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294399 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp index f623b81df3a..60786a3373f 100644 --- a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -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++;