diff options
| author | Owen Anderson <resistor@mac.com> | 2008-01-25 10:10:33 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2008-01-25 10:10:33 +0000 |
| commit | 6af19fd1e2974684362c72d23d413d84fbc841b0 (patch) | |
| tree | 784178b735d23c99b7a29d674a00c7fef9a239c1 /llvm/lib/Transforms | |
| parent | fe34236d73f5b2dba075f7a9801b383cd8a5b814 (diff) | |
| download | bcm5719-llvm-6af19fd1e2974684362c72d23d413d84fbc841b0.tar.gz bcm5719-llvm-6af19fd1e2974684362c72d23d413d84fbc841b0.zip | |
DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
llvm-svn: 46351
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index 6aa1c63f929..f4b432f88e5 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -261,9 +261,6 @@ bool DSE::handleEndBlock(BasicBlock& BB, for (BasicBlock::iterator BBI = BB.end(); BBI != BB.begin(); ){ --BBI; - if (deadPointers.empty()) - break; - // If we find a store whose pointer is dead... if (StoreInst* S = dyn_cast<StoreInst>(BBI)) { if (!S->isVolatile()) { @@ -271,8 +268,12 @@ bool DSE::handleEndBlock(BasicBlock& BB, // See through pointer-to-pointer bitcasts TranslatePointerBitCasts(pointerOperand); - if (isa<AllocaInst>(pointerOperand) && - deadPointers.count(cast<AllocaInst>(pointerOperand))) { + // Alloca'd pointers or byval arguments (which are functionally like + // alloca's) are valid candidates for removal. + if ( (isa<AllocaInst>(pointerOperand) && + deadPointers.count(cast<AllocaInst>(pointerOperand))) || + (isa<Argument>(pointerOperand) && + cast<Argument>(pointerOperand)->hasByValAttr())) { // Remove it! MD.removeInstruction(S); |

