summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IVUsers.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-27 15:30:00 +0000
committerDan Gohman <gohman@apple.com>2009-09-27 15:30:00 +0000
commit6daa565cf92224d02b9a5d04c575287b5bb32b77 (patch)
treeb48b999260a645a8f2c9c011d976a7112905c3ef /llvm/lib/Analysis/IVUsers.cpp
parentf39a3a928815f5f6d61ac3790ace7c2367adf0fb (diff)
downloadbcm5719-llvm-6daa565cf92224d02b9a5d04c575287b5bb32b77.tar.gz
bcm5719-llvm-6daa565cf92224d02b9a5d04c575287b5bb32b77.zip
Instead of testing whether an instruction dominates the loop preheader,
test whether it properly dominates the loop header. This is equivalent when the loop has a preheader, and has the advantage of working when the loop doesn't have a preheader. Since IVUsers doesn't Require LoopSimplify, the loop isn't guaranteed to have a preheader. llvm-svn: 82899
Diffstat (limited to 'llvm/lib/Analysis/IVUsers.cpp')
-rw-r--r--llvm/lib/Analysis/IVUsers.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/IVUsers.cpp b/llvm/lib/Analysis/IVUsers.cpp
index ecb7df80cf1..543e017fc9d 100644
--- a/llvm/lib/Analysis/IVUsers.cpp
+++ b/llvm/lib/Analysis/IVUsers.cpp
@@ -121,11 +121,11 @@ static bool getSCEVStartAndStride(const SCEV *&SH, Loop *L, Loop *UseLoop,
Start = SE->getAddExpr(Start, AddRecStart);
- // If stride is an instruction, make sure it dominates the loop preheader.
+ // If stride is an instruction, make sure it properly dominates the header.
// Otherwise we could end up with a use before def situation.
if (!isa<SCEVConstant>(AddRecStride)) {
- BasicBlock *Preheader = L->getLoopPreheader();
- if (!AddRecStride->dominates(Preheader, DT))
+ BasicBlock *Header = L->getHeader();
+ if (!AddRecStride->properlyDominates(Header, DT))
return false;
DEBUG(errs() << "[" << L->getHeader()->getName()
OpenPOWER on IntegriCloud