Revert r137655. There is some question about whether the 'landingpad'
authorBill Wendling <isanbard@gmail.com>
Wed, 17 Aug 2011 20:36:44 +0000 (20:36 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 17 Aug 2011 20:36:44 +0000 (20:36 +0000)
instruction should be marked as potentially reading and/or writing memory.

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

lib/Analysis/LoopInfo.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp
lib/VMCore/Instruction.cpp

index 9a7c50d7fa4492506069bf6534497b3806dfd8f6..36fd598d13c4cc19f657b9cd198ced7a1032f3d3 100644 (file)
@@ -99,6 +99,9 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
     return false;
   if (I->mayReadFromMemory())
     return false;
+  // The landingpad instruction is immobile.
+  if (isa<LandingPadInst>(I))
+    return false;
   // Determine the insertion point, unless one was given.
   if (!InsertPt) {
     BasicBlock *Preheader = getLoopPreheader();
index 47e7dd4c2203ed6aeae6daa50402144070a888c1..838678b9fab733bcef485585fa3ae4e4e0730482 100644 (file)
@@ -1418,7 +1418,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->mayHaveSideEffects() || isa<TerminatorInst>(I))
+  if (isa<PHINode>(I) || isa<LandingPadInst>(I) || I->mayHaveSideEffects() ||
+      isa<TerminatorInst>(I))
     return false;
 
   // Do not sink alloca instructions out of the entry block.
index 863b098e8f8c8cd95cd0dbba79e2a4bd931d4b46..f54cec11e2e3f3fa1d6d33ce9933143fda4e8e72 100644 (file)
@@ -320,7 +320,6 @@ bool Instruction::mayReadFromMemory() const {
   case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory
   case Instruction::AtomicCmpXchg:
   case Instruction::AtomicRMW:
-  case Instruction::LandingPad:
     return true;
   case Instruction::Call:
     return !cast<CallInst>(this)->doesNotAccessMemory();
@@ -341,7 +340,6 @@ bool Instruction::mayWriteToMemory() const {
   case Instruction::VAArg:
   case Instruction::AtomicCmpXchg:
   case Instruction::AtomicRMW:
-  case Instruction::LandingPad:
     return true;
   case Instruction::Call:
     return !cast<CallInst>(this)->onlyReadsMemory();