diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-10-27 17:13:11 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-10-27 17:13:11 +0000 |
| commit | c4f67e67d27f54eb5e60cbbcfcb611f695afcc53 (patch) | |
| tree | 25b37672bc833fa5c0a3fee897b00c54d5f2c3d1 /llvm | |
| parent | 479911f97165dc8731cab4126c8e771299f694c4 (diff) | |
| download | bcm5719-llvm-c4f67e67d27f54eb5e60cbbcfcb611f695afcc53.tar.gz bcm5719-llvm-c4f67e67d27f54eb5e60cbbcfcb611f695afcc53.zip | |
Do not sink any instruction with side effects, including vaarg. This fixes
PR640
llvm-svn: 24046
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 7db409d39e2..4aab0963352 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5717,8 +5717,8 @@ void InstCombiner::removeFromWorkList(Instruction *I) { static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { assert(I->hasOneUse() && "Invariants didn't hold!"); - // Cannot move control-flow-involving instructions. - if (isa<PHINode>(I) || isa<InvokeInst>(I) || isa<CallInst>(I)) return false; + // Cannot move control-flow-involving, volatile loads, vaarg, etc. + if (isa<PHINode>(I) || I->mayWriteToMemory()) return false; // Do not sink alloca instructions out of the entry block. if (isa<AllocaInst>(I) && I->getParent() == &DestBlock->getParent()->front()) @@ -5727,8 +5727,6 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { // We can only sink load instructions if there is nothing between the load and // the end of block that could change the value. if (LoadInst *LI = dyn_cast<LoadInst>(I)) { - if (LI->isVolatile()) return false; // Don't sink volatile loads. - for (BasicBlock::iterator Scan = LI, E = LI->getParent()->end(); Scan != E; ++Scan) if (Scan->mayWriteToMemory()) |

