summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-08 17:37:37 +0000
committerChris Lattner <sabre@nondot.org>2008-05-08 17:37:37 +0000
commit49a594e6abe6e902cc6e5bc61322b56bf7c3a0ba (patch)
treea234e98607964dea6443417d98ec44497e927e8b /llvm/lib/Transforms/Scalar
parent4fa09669d8dfc09660a1364c36ac1d4250d142c8 (diff)
downloadbcm5719-llvm-49a594e6abe6e902cc6e5bc61322b56bf7c3a0ba.tar.gz
bcm5719-llvm-49a594e6abe6e902cc6e5bc61322b56bf7c3a0ba.zip
More than just loads can read from memory: readonly calls like strlen
also need to be checked for memory modifying instructions before we can sink them. THis fixes the second half of PR2297. llvm-svn: 50860
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index b0ea9f5c43f..772ef63121b 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11229,8 +11229,8 @@ 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)) {
- for (BasicBlock::iterator Scan = LI, E = LI->getParent()->end();
+ if (I->mayReadFromMemory()) {
+ for (BasicBlock::iterator Scan = I, E = I->getParent()->end();
Scan != E; ++Scan)
if (Scan->mayWriteToMemory())
return false;
@@ -11388,8 +11388,8 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
}
// See if we can trivially sink this instruction to a successor basic block.
- // FIXME: Remove GetResultInst test when first class support for aggregates is
- // implemented.
+ // FIXME: Remove GetResultInst test when first class support for aggregates
+ // is implemented.
if (I->hasOneUse() && !isa<GetResultInst>(I)) {
BasicBlock *BB = I->getParent();
BasicBlock *UserParent = cast<Instruction>(I->use_back())->getParent();
OpenPOWER on IntegriCloud