[llvm-commits] [llvm] r82899 - /llvm/trunk/lib/Analysis/IVUsers.cpp
Dan Gohman
gohman at apple.com
Sun Sep 27 08:30:00 PDT 2009
Author: djg
Date: Sun Sep 27 10:30:00 2009
New Revision: 82899
URL: http://llvm.org/viewvc/llvm-project?rev=82899&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/IVUsers.cpp
Modified: llvm/trunk/lib/Analysis/IVUsers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IVUsers.cpp?rev=82899&r1=82898&r2=82899&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IVUsers.cpp (original)
+++ llvm/trunk/lib/Analysis/IVUsers.cpp Sun Sep 27 10:30:00 2009
@@ -121,11 +121,11 @@
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()
More information about the llvm-commits
mailing list