summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-03-06 02:45:26 +0000
committerDale Johannesen <dalej@apple.com>2010-03-06 02:45:26 +0000
commit066b8ea59006decf741b54c437da6d5dc6ab4e0d (patch)
tree7140add1872b48f146960445b72bf734ffbdd5a2
parent99d20f83ba82787082e07f40040f77a4e224c5ce (diff)
downloadbcm5719-llvm-066b8ea59006decf741b54c437da6d5dc6ab4e0d.tar.gz
bcm5719-llvm-066b8ea59006decf741b54c437da6d5dc6ab4e0d.zip
Fix another case where LSR was affected by debug info.
llvm-svn: 97865
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 5808c75fd39..e27da966924 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
OpenPOWER on IntegriCloud