aboutsummaryrefslogtreecommitdiffstats
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
commit6a038b4fc9bf564633800741edb09748d4a4b1fd (patch)
treef755907a4be8f35a0933a8fcc33756c7d1d64fc5
parentc6fd7723f48b4774f43556c0cdf59e21ca198839 (diff)
downloadexternal_llvm-6a038b4fc9bf564633800741edb09748d4a4b1fd.zip
external_llvm-6a038b4fc9bf564633800741edb09748d4a4b1fd.tar.gz
external_llvm-6a038b4fc9bf564633800741edb09748d4a4b1fd.tar.bz2
Bug fix. Only safe to perform extension uses optimization if the source of extension is also defined in the same BB as the extension.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44896 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 594c017..37a645f 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/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) {