diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-27 15:30:00 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-27 15:30:00 +0000 |
commit | 00cb67359fc2515eb972cd41fa35f8a0d2b22b87 (patch) | |
tree | 9b35397fbcf607b5f4de6785e772eed710aec769 /lib/Analysis | |
parent | 6e70e31810464289a9e9b37e0345847e3ca5d5cf (diff) | |
download | external_llvm-00cb67359fc2515eb972cd41fa35f8a0d2b22b87.zip external_llvm-00cb67359fc2515eb972cd41fa35f8a0d2b22b87.tar.gz external_llvm-00cb67359fc2515eb972cd41fa35f8a0d2b22b87.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/IVUsers.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/IVUsers.cpp b/lib/Analysis/IVUsers.cpp index ecb7df8..543e017 100644 --- a/lib/Analysis/IVUsers.cpp +++ b/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() |