summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-08-17 20:36:44 +0000
committerBill Wendling <isanbard@gmail.com>2011-08-17 20:36:44 +0000
commitc9b2a987a291434490fd5b3b6e98b9992916ece4 (patch)
tree8d15e446ffe463064e51ba5b79d7c82ee90434a6
parent53727fc659af5f8fc51499fd875165533187d734 (diff)
downloadllvm-c9b2a987a291434490fd5b3b6e98b9992916ece4.tar.gz
llvm-c9b2a987a291434490fd5b3b6e98b9992916ece4.tar.bz2
llvm-c9b2a987a291434490fd5b3b6e98b9992916ece4.tar.xz
Revert r137655. There is some question about whether the 'landingpad'
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
-rw-r--r--lib/Analysis/LoopInfo.cpp3
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp3
-rw-r--r--lib/VMCore/Instruction.cpp2
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 9a7c50d7fa..36fd598d13 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -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();
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 47e7dd4c22..838678b9fa 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -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.
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 863b098e8f..f54cec11e2 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -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();