[llvm-commits] [llvm] r40812 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Chris Lattner sabre at nondot.org
Fri Aug 3 19:38:38 PDT 2007


Author: lattner
Date: Fri Aug  3 21:38:38 2007
New Revision: 40812

URL: http://llvm.org/viewvc/llvm-project?rev=40812&view=rev
Log:
When we do the single-store optimization, delete both the store
and the alloca so they don't get reprocessed.

This speeds up PR1432 from 2.20s to 2.17s.

Modified:
    llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40812&r1=40811&r2=40812&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Fri Aug  3 21:38:38 2007
@@ -290,9 +290,15 @@
 
       // Finally, after the scan, check to see if the store is all that is left.
       if (Info.UsingBlocks.empty()) {
-        ++NumSingleStore;
+        // Remove the (now dead) store and alloca.
+        Info.OnlyStore->eraseFromParent();
+        if (AST) AST->deleteValue(AI);
+        AI->eraseFromParent();
+        
         // The alloca has been processed, move on.
         RemoveFromAllocasList(AllocaNum);
+        
+        ++NumSingleStore;
         continue;
       }
     }
@@ -728,7 +734,7 @@
         if (AIt != CurValues.end()) {
           // Store updates the "current value"...
           AIt->second = SI->getOperand(0);
-          BB->getInstList().erase(SI);
+          SI->eraseFromParent();
         }
       }
     }





More information about the llvm-commits mailing list