Don't sink the instruction to before a landingpad instruction.
authorBill Wendling <isanbard@gmail.com>
Mon, 15 Aug 2011 22:53:05 +0000 (22:53 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 15 Aug 2011 22:53:05 +0000 (22:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137672 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstructionCombining.cpp

index 0a92efe37e9d27f4b08648b356cf1a71656ae5c8..f13733cf05c92b2bce57cf2fd882eaf451b6356f 100644 (file)
@@ -1436,7 +1436,7 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
   }
 
   BasicBlock::iterator InsertPos = DestBlock->getFirstNonPHI();
-
+  if (isa<LandingPadInst>(InsertPos)) ++InsertPos; // Skip landingpad inst.
   I->moveBefore(InsertPos);
   ++NumSunkInst;
   return true;