From: Evan Cheng Date: Wed, 12 Dec 2007 00:51:06 +0000 (+0000) Subject: Bug fix. Only safe to perform extension uses optimization if the source of extension... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=772de516b6851e679d3da9e5171712b9c3122019;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 594c017ba8a..37a645f3ce8 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(Src)->getParent()) + return false; + bool DefIsLiveOut = false; for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) {