1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

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.

llvm-svn: 137655
This commit is contained in:
Bill Wendling 2011-08-15 21:14:31 +00:00
parent b25f5aeda5
commit a75d2d0416
3 changed files with 4 additions and 6 deletions

View File

@ -99,9 +99,6 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
return false; return false;
if (I->mayReadFromMemory()) if (I->mayReadFromMemory())
return false; return false;
// The landingpad instruction is immobile.
if (isa<LandingPadInst>(I))
return false;
// Determine the insertion point, unless one was given. // Determine the insertion point, unless one was given.
if (!InsertPt) { if (!InsertPt) {
BasicBlock *Preheader = getLoopPreheader(); BasicBlock *Preheader = getLoopPreheader();

View File

@ -1417,9 +1417,8 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
assert(I->hasOneUse() && "Invariants didn't hold!"); assert(I->hasOneUse() && "Invariants didn't hold!");
// Cannot move control-flow-involving, volatile loads, vaarg, landingpad, etc. // Cannot move control-flow-involving, volatile loads, vaarg, etc.
if (isa<PHINode>(I) || isa<LandingPadInst>(I) || I->mayHaveSideEffects() || if (isa<PHINode>(I) || I->mayHaveSideEffects() || isa<TerminatorInst>(I))
isa<TerminatorInst>(I))
return false; return false;
// Do not sink alloca instructions out of the entry block. // Do not sink alloca instructions out of the entry block.

View File

@ -320,6 +320,7 @@ bool Instruction::mayReadFromMemory() const {
case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory
case Instruction::AtomicCmpXchg: case Instruction::AtomicCmpXchg:
case Instruction::AtomicRMW: case Instruction::AtomicRMW:
case Instruction::LandingPad:
return true; return true;
case Instruction::Call: case Instruction::Call:
return !cast<CallInst>(this)->doesNotAccessMemory(); return !cast<CallInst>(this)->doesNotAccessMemory();
@ -340,6 +341,7 @@ bool Instruction::mayWriteToMemory() const {
case Instruction::VAArg: case Instruction::VAArg:
case Instruction::AtomicCmpXchg: case Instruction::AtomicCmpXchg:
case Instruction::AtomicRMW: case Instruction::AtomicRMW:
case Instruction::LandingPad:
return true; return true;
case Instruction::Call: case Instruction::Call:
return !cast<CallInst>(this)->onlyReadsMemory(); return !cast<CallInst>(this)->onlyReadsMemory();