summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-12-12 00:51:06 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-12-12 00:51:06 +0000
commit7bc894253220b1b4469f846a37cf6855f2ecd673 (patch)
tree30014fd737cd6b1a14db039cf8cdde30bf4cfc77 /llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
parent0af43a189528f7a8feb9129fcb8df1d9859e1b24 (diff)
downloadbcm5719-llvm-7bc894253220b1b4469f846a37cf6855f2ecd673.tar.gz
bcm5719-llvm-7bc894253220b1b4469f846a37cf6855f2ecd673.zip
Bug fix. Only safe to perform extension uses optimization if the source of extension is also defined in the same BB as the extension.
llvm-svn: 44896
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 594c017ba8a..37a645f3ce8 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -929,6 +929,11 @@ bool CodeGenPrepare::OptimizeExtUses(Instruction *I) {
if (Src->hasOneUse())
return false;
+ // Only safe to perform the optimization if the source is also defined in
+ // this block.
+ if (DefBB != cast<Instruction>(Src)->getParent())
+ return false;
+
bool DefIsLiveOut = false;
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
UI != E; ++UI) {
OpenPOWER on IntegriCloud