aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commit2539e3389361115f5e75e4134bdd123171688ddc (patch)
tree4552fc266a066d3293bde3e93cb635b613cfb999 /lib
parent0ef546e639d45207b4776c80408c84170ad1cac6 (diff)
downloadexternal_llvm-2539e3389361115f5e75e4134bdd123171688ddc.zip
external_llvm-2539e3389361115f5e75e4134bdd123171688ddc.tar.gz
external_llvm-2539e3389361115f5e75e4134bdd123171688ddc.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index b0ea9f5..772ef63 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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();