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();
         }
       }
     }


_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to