[PATCH] D15537: limit the number of instructions per block examined by dead store elimination

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:04:50 PDT 2016


reames added inline comments.

================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:490
@@ -489,3 +489,3 @@
   // Do a top-down walk on the BB.
   for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; ) {
     Instruction *Inst = &*BBI++;
----------------
I'm wondering whether we can solve the practical problem with a caching change.  

What if we simply chose to cache the intermediate MDA results?  (Note that MDA does not do this for the getPointerDependencyFrom interface.)  

I'm picturing a simple cache structure of Map<pair<MemoryLoc, Instruction>, MemDepResult>

This wouldn't reduce the worst case complexity (it could be each instruction has a different memory location associated with it which is may alias with all others), but how many unique memory locations do we see in practice?  And out of those, how many are mayalias (i.e. not a possible read or def which terminates a chain)?



================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:522
@@ -521,3 +521,3 @@
 
       if (LoadInst *DepLoad = dyn_cast<LoadInst>(SI->getValueOperand())) {
         if (SI->getPointerOperand() == DepLoad->getPointerOperand() &&
----------------
FYI: this patch clearly needs rebased


https://reviews.llvm.org/D15537





More information about the llvm-commits mailing list