From 75bd1d7575dc7299dd5714588e2ca2b4d5658878 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Wed, 8 Feb 2017 02:48:25 +0000 Subject: [PATCH] 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 --- lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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++; -- 2.40.0