forked from OSchip/llvm-project
[IndVars] Quick fix LHS/RHS bug
The code relies on fact that LHS is the NarrowDef but never really checks it. Adding the conservative restrictive check, will follow-up with handling of case where RHS is a NarrowDef.
This commit is contained in:
parent
dec1bbb47c
commit
3df0daceb2
llvm/lib/Transforms/Utils
|
@ -1595,6 +1595,9 @@ bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) {
|
||||||
return false;
|
return false;
|
||||||
const SCEV *LHS = SE->getSCEV(OBO->getOperand(0));
|
const SCEV *LHS = SE->getSCEV(OBO->getOperand(0));
|
||||||
const SCEV *RHS = SE->getSCEV(OBO->getOperand(1));
|
const SCEV *RHS = SE->getSCEV(OBO->getOperand(1));
|
||||||
|
// TODO: Support case for NarrowDef = NarrowUse->getOperand(1).
|
||||||
|
if (NarrowUse->getOperand(0) != NarrowDef)
|
||||||
|
return false;
|
||||||
if (!SE->isKnownNegative(RHS))
|
if (!SE->isKnownNegative(RHS))
|
||||||
return false;
|
return false;
|
||||||
bool ProvedSubNUW = SE->isKnownPredicateAt(
|
bool ProvedSubNUW = SE->isKnownPredicateAt(
|
||||||
|
|
Loading…
Reference in New Issue