aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-01-25 10:10:33 +0000
committerOwen Anderson <resistor@mac.com>2008-01-25 10:10:33 +0000
commite3c36f67580f0963abdf696a26690facb0791ce0 (patch)
tree46a0bf68c06c563faed90f7d64869c00a9ab98e4 /lib/Transforms
parentbc2458408a68cc798ca1d54f8fdc2a7966165b41 (diff)
DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 6aa1c63f92..f4b432f88e 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/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);