[PATCH] D29679: CVP: Make CVP iterate in an order that maximizes reuse of LVI cache

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 18:46:38 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294398: CVP: Make CVP iterate in an order that maximizes reuse of LVI cache (authored by dannyb).

Changed prior to commit:
  https://reviews.llvm.org/D29679?vs=87508&id=87582#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29679

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


Index: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -481,12 +481,11 @@
 static bool runImpl(Function &F, LazyValueInfo *LVI) {
   bool FnChanged = false;
 
-  // 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())) {
+  // 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())) {
     bool BBChanged = false;
     for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
       Instruction *II = &*BI++;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29679.87582.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170208/a643f785/attachment.bin>


More information about the llvm-commits mailing list