diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-04 02:38:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-04 02:38:38 +0000 |
commit | 4f63e76cda86b676e4f0e31fd35b812e2f8dd57f (patch) | |
tree | 790e1e26645ebfae8c5f71787fb2df2eb738de34 /lib/Transforms | |
parent | d0458e5d4f29ce1e9ba1def22d06b362ae2c1999 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 02eeb3cc0a..1106c6ea16 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -290,9 +290,15 @@ void PromoteMem2Reg::run() { // 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 @@ PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector<AllocaInst*> &AIs) { if (AIt != CurValues.end()) { // Store updates the "current value"... AIt->second = SI->getOperand(0); - BB->getInstList().erase(SI); + SI->eraseFromParent(); } } } |