From 9d6070f161d89376c7c834950f518e25e34d7ce8 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 15 Aug 2011 21:14:31 +0000 Subject: [PATCH] Duncan pointed out that the LandingPadInst might read memory. (It might also write to memory.) Marking it as such makes some checks for immobility go away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137655 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LoopInfo.cpp | 3 --- lib/Transforms/InstCombine/InstructionCombining.cpp | 5 ++--- lib/VMCore/Instruction.cpp | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index 36fd598d13c..9a7c50d7fa4 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -99,9 +99,6 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed, return false; if (I->mayReadFromMemory()) return false; - // The landingpad instruction is immobile. - if (isa(I)) - return false; // Determine the insertion point, unless one was given. if (!InsertPt) { BasicBlock *Preheader = getLoopPreheader(); diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 32c55a3408d..41d542af685 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1417,9 +1417,8 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) { static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { assert(I->hasOneUse() && "Invariants didn't hold!"); - // Cannot move control-flow-involving, volatile loads, vaarg, landingpad, etc. - if (isa(I) || isa(I) || I->mayHaveSideEffects() || - isa(I)) + // Cannot move control-flow-involving, volatile loads, vaarg, etc. + if (isa(I) || I->mayHaveSideEffects() || isa(I)) return false; // Do not sink alloca instructions out of the entry block. diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 22656f3353d..9e55a083db0 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -320,6 +320,7 @@ 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(this)->doesNotAccessMemory(); @@ -340,6 +341,7 @@ bool Instruction::mayWriteToMemory() const { case Instruction::VAArg: case Instruction::AtomicCmpXchg: case Instruction::AtomicRMW: + case Instruction::LandingPad: return true; case Instruction::Call: return !cast(this)->onlyReadsMemory(); -- 2.34.1