[llvm-commits] [llvm] r44896 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Evan Cheng evan.cheng at apple.com
Tue Dec 11 16:51:06 PST 2007


Author: evancheng
Date: Tue Dec 11 18:51:06 2007
New Revision: 44896

URL: http://llvm.org/viewvc/llvm-project?rev=44896&view=rev
Log:
Bug fix. Only safe to perform extension uses optimization if the source of extension is also defined in the same BB as the extension.

Modified:
    llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44896&r1=44895&r2=44896&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Dec 11 18:51:06 2007
@@ -929,6 +929,11 @@
   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) {





More information about the llvm-commits mailing list