summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-08 02:17:32 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-08 02:17:32 +0000
commit08ec0a81227900e660883b4ddc0e085eb551d08a (patch)
treec19953bc36cdd9de9914bf5f81c9253e93abbb5d /llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
parent40d557107f13a3b1781d83e0b41bc15754ddad07 (diff)
downloadbcm5719-llvm-08ec0a81227900e660883b4ddc0e085eb551d08a.tar.gz
bcm5719-llvm-08ec0a81227900e660883b4ddc0e085eb551d08a.zip
isAllocLikeFn is allowed to return true for functions which read memory; make
sure we account for that correctly in DeadStoreElimination. Fixes a regression from r158919. PR13547. llvm-svn: 161468
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 5eff0e5a361..dcae458606e 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -740,12 +740,19 @@ bool DSE::handleEndBlock(BasicBlock &BB) {
continue;
}
- if (isa<AllocaInst>(BBI) || isAllocLikeFn(BBI)) {
+ if (isa<AllocaInst>(BBI)) {
+ // Remove allocas from the list of dead stack objects; there can't be
+ // any references before the definition.
DeadStackObjects.remove(BBI);
continue;
}
if (CallSite CS = cast<Value>(BBI)) {
+ // Remove allocation function calls from the list of dead stack objects;
+ // there can't be any references before the definition.
+ if (isAllocLikeFn(BBI))
+ DeadStackObjects.remove(BBI);
+
// If this call does not access memory, it can't be loading any of our
// pointers.
if (AA->doesNotAccessMemory(CS))
@@ -771,7 +778,7 @@ bool DSE::handleEndBlock(BasicBlock &BB) {
// If all of the allocas were clobbered by the call then we're not going
// to find anything else to process.
if (DeadStackObjects.empty())
- return MadeChange;
+ break;
continue;
}
OpenPOWER on IntegriCloud