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 | 1b215f0661c8ae6b129f8e323e96f7b142be4d39 (patch) | |
| tree | 9875f92afa1eb3e027fb97913aeeab861f7bf79a /llvm/lib/Transforms | |
| parent | 862f1254577f41c6ea08fe51504f0fdb7bcab1a1 (diff) | |
| download | bcm5719-llvm-1b215f0661c8ae6b129f8e323e96f7b142be4d39.tar.gz bcm5719-llvm-1b215f0661c8ae6b129f8e323e96f7b142be4d39.zip | |
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.
llvm-svn: 40812
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 02eeb3cc0a4..1106c6ea163 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/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(); } } } |

