mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
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
This commit is contained in:
parent
b84f5a3421
commit
16398e3bc0
@ -121,11 +121,11 @@ static bool getSCEVStartAndStride(const SCEV *&SH, Loop *L, Loop *UseLoop,
|
|||||||
|
|
||||||
Start = SE->getAddExpr(Start, AddRecStart);
|
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.
|
// Otherwise we could end up with a use before def situation.
|
||||||
if (!isa<SCEVConstant>(AddRecStride)) {
|
if (!isa<SCEVConstant>(AddRecStride)) {
|
||||||
BasicBlock *Preheader = L->getLoopPreheader();
|
BasicBlock *Header = L->getHeader();
|
||||||
if (!AddRecStride->dominates(Preheader, DT))
|
if (!AddRecStride->properlyDominates(Header, DT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DEBUG(errs() << "[" << L->getHeader()->getName()
|
DEBUG(errs() << "[" << L->getHeader()->getName()
|
||||||
|
Loading…
Reference in New Issue
Block a user