diff options
author | Dan Gohman <gohman@apple.com> | 2010-02-14 03:12:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-02-14 03:12:47 +0000 |
commit | 6b7517342e5f9eee8edf28abf7db7be35e7c8f39 (patch) | |
tree | a9e48674bf0ff5e935745a121b9923997f55ebf5 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | f446713fd01ea1b5ab19f4ab42f4f082fc0e1039 (diff) | |
download | bcm5719-llvm-6b7517342e5f9eee8edf28abf7db7be35e7c8f39.tar.gz bcm5719-llvm-6b7517342e5f9eee8edf28abf7db7be35e7c8f39.zip |
In rememberInstruction, if the value being remembered is the
current insertion point, advance the current insertion point.
This avoids a use-before-def situation in a testcase extracted
from clang which is difficult to reduce to a reasonable-sized
regression test.
llvm-svn: 96151
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 5de55fed482..88c22b16038 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1075,6 +1075,20 @@ Value *SCEVExpander::expand(const SCEV *S) { return V; } +void SCEVExpander::rememberInstruction(Value *I) { + if (!PostIncLoop) + InsertedValues.insert(I); + + // If we just claimed an existing instruction and that instruction had + // been the insert point, adjust the insert point forward so that + // subsequently inserted code will be dominated. + if (Builder.GetInsertPoint() == I) { + BasicBlock::iterator It = cast<Instruction>(I); + do { ++It; } while (isInsertedInstruction(It)); + Builder.SetInsertPoint(Builder.GetInsertBlock(), It); + } +} + /// getOrInsertCanonicalInductionVariable - This method returns the /// canonical induction variable of the specified type for the specified /// loop (inserting one if there is none). A canonical induction variable |