don't sink invokes, even if they are readonly. This fixes a
authorChris Lattner <sabre@nondot.org>
Fri, 9 May 2008 15:07:33 +0000 (15:07 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 9 May 2008 15:07:33 +0000 (15:07 +0000)
crash on kimwitu++.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50901 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index e8b60f890c29b4d156dbf82a0db44582fead2578..f3591879f7bb039c14f2bbe9bd7682d14ed884f6 100644 (file)
@@ -11233,7 +11233,8 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
   assert(I->hasOneUse() && "Invariants didn't hold!");
 
   // Cannot move control-flow-involving, volatile loads, vaarg, etc.
-  if (isa<PHINode>(I) || I->mayWriteToMemory()) return false;
+  if (isa<PHINode>(I) || I->mayWriteToMemory() || isa<TerminatorInst>(I))
+    return false;
 
   // Do not sink alloca instructions out of the entry block.
   if (isa<AllocaInst>(I) && I->getParent() ==