diff options
author | Dale Johannesen <dalej@apple.com> | 2010-03-05 21:12:40 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-03-05 21:12:40 +0000 |
commit | f5cc1cdc6532a6245293b3dd25e6f860db9aaef2 (patch) | |
tree | b7a034b2112ce5e884aaf9b3614971edaf5d2455 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | d214ed0e751c0e1075c473eeb4d268f719330ceb (diff) | |
download | bcm5719-llvm-f5cc1cdc6532a6245293b3dd25e6f860db9aaef2.tar.gz bcm5719-llvm-f5cc1cdc6532a6245293b3dd25e6f860db9aaef2.zip |
Fix a case where LSR is sensitive to debug info.
llvm-svn: 97830
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index f5f10c8961b..5808c75fd39 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/STLExtras.h" @@ -137,6 +138,10 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, if (IP != BlockBegin) { --IP; for (; ScanLimit; --IP, --ScanLimit) { + // Don't count dbg.value against the ScanLimit, to avoid perturbing the + // generated code. + if (isa<DbgInfoIntrinsic>(IP)) + ScanLimit++; if (IP->getOpcode() == (unsigned)Opcode && IP->getOperand(0) == LHS && IP->getOperand(1) == RHS) return IP; @@ -505,6 +510,10 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin, if (IP != BlockBegin) { --IP; for (; ScanLimit; --IP, --ScanLimit) { + // Don't count dbg.value against the ScanLimit, to avoid perturbing the + // generated code. + if (isa<DbgInfoIntrinsic>(IP)) + ScanLimit++; if (IP->getOpcode() == Instruction::GetElementPtr && IP->getOperand(0) == V && IP->getOperand(1) == Idx) return IP; |