diff options
| author | Dale Johannesen <dalej@apple.com> | 2010-03-06 02:45:26 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2010-03-06 02:45:26 +0000 |
| commit | 066b8ea59006decf741b54c437da6d5dc6ab4e0d (patch) | |
| tree | 7140add1872b48f146960445b72bf734ffbdd5a2 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
| parent | 99d20f83ba82787082e07f40040f77a4e224c5ce (diff) | |
| download | llvm-066b8ea59006decf741b54c437da6d5dc6ab4e0d.zip llvm-066b8ea59006decf741b54c437da6d5dc6ab4e0d.tar.gz llvm-066b8ea59006decf741b54c437da6d5dc6ab4e0d.tar.bz2 | |
Fix another case where LSR was affected by debug info.
llvm-svn: 97865
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 5808c75..e27da96 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1267,8 +1267,19 @@ Value *SCEVExpander::expand(const SCEV *S) { L = L->getParentLoop()) if (S->isLoopInvariant(L)) { if (!L) break; - if (BasicBlock *Preheader = L->getLoopPreheader()) + if (BasicBlock *Preheader = L->getLoopPreheader()) { InsertPt = Preheader->getTerminator(); + BasicBlock::iterator IP = InsertPt; + // Back past any debug info instructions. Sometimes we inserted + // something earlier before debug info but after any real instructions. + // This should behave the same as if debug info was not present. + while (IP != Preheader->begin()) { + --IP; + if (!isa<DbgInfoIntrinsic>(IP)) + break; + InsertPt = IP; + } + } } else { // If the SCEV is computable at this level, insert it into the header // after the PHIs (and after any other instructions that we've inserted |
