[llvm-branch-commits] [llvm-branch] r113682 - /llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp

Gabor Greif ggreif at gmail.com
Sat Sep 11 03:47:48 PDT 2010


Author: ggreif
Date: Sat Sep 11 05:47:47 2010
New Revision: 113682

URL: http://llvm.org/viewvc/llvm-project?rev=113682&view=rev
Log:
fix an assertion when the trunc is the first in the block

Modified:
    llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=113682&r1=113681&r2=113682&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp Sat Sep 11 05:47:47 2010
@@ -901,8 +901,13 @@
   const Type *Ty = condition->getType();
 
   if (TruncInst *T = dyn_cast<TruncInst>(condition)) {
-    condition = T->getOperand(0); 
-    if (condition != --BasicBlock::iterator(T)/*&& TODO: CHEAP TRUNCATES*/)
+    if (Instruction *P = dyn_cast<Instruction>(T->getOperand(0))) { 
+      if (Old != P->getParent() ||
+	condition != --BasicBlock::iterator(T)/* TODO: CHEAP TRUNCATES*/)
+      return false;
+      condition = P;
+    }
+    else
       return false;
   }
 





More information about the llvm-branch-commits mailing list