summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-06 00:42:50 +0000
committerDale Johannesen <dalej@apple.com>2009-03-06 00:42:50 +0000
commit073ab5acab82deef12017f17530259479dbfe15e (patch)
tree119293a59c7c85d38f0372f13ced550c5f30f7ed /llvm/lib
parentab16577adef66724af1f31440cbe535522fdcf6d (diff)
downloadbcm5719-llvm-073ab5acab82deef12017f17530259479dbfe15e.tar.gz
bcm5719-llvm-073ab5acab82deef12017f17530259479dbfe15e.zip
Tweak the check for promotable alloca's to handle
debug intrinsics correctly. llvm-svn: 66225
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index cc626ae71f5..e3dd72daf70 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -81,9 +81,15 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) {
if (SI->isVolatile())
return false;
} else if (const BitCastInst *BC = dyn_cast<BitCastInst>(*UI)) {
- // Uses by dbg info shouldn't inhibit promotion.
+ // A bitcast that does not feed into debug info inhibits promotion.
if (!BC->hasOneUse() || !isa<DbgInfoIntrinsic>(*BC->use_begin()))
return false;
+ // If the only use is by debug info, this alloca will not exist in
+ // non-debug code, so don't try to promote; this ensures the same
+ // codegen with debug info. Otherwise, debug info should not
+ // inhibit promotion (but we must examine other uses).
+ if (AI->hasOneUse())
+ return false;
} else {
return false;
}
OpenPOWER on IntegriCloud