Skip to content

Commit f1fc8ab

Browse files
committed
!fixup address latest comments, thanks
1 parent 1057c67 commit f1fc8ab

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ const SCEV *ScalarEvolution::getZeroExtendExprImpl(const SCEV *Op, Type *Ty,
18181818

18191819
if (auto *SM = dyn_cast<SCEVMulExpr>(Op)) {
18201820
// zext((A * B * ...)<nuw>) --> (zext(A) * zext(B) * ...)<nuw>
1821-
if (SM->hasNoUnsignedWrap() /*|| getUnsignedRange(SM->getOperand(0)).unsignedMulMayOverflow(getUnsignedRange()) ==ConstantRange::OverflowResult::NeverOverflows*/) {
1821+
if (SM->hasNoUnsignedWrap()) {
18221822
// If the multiply does not unsign overflow then we can, by definition,
18231823
// commute the zero extension with the multiply operation.
18241824
SmallVector<const SCEV *, 4> Ops;
@@ -3200,7 +3200,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
32003200
}
32013201
}
32023202

3203-
// Try to push the constant operand into a ZExt: C + zext (A + B) ->
3203+
// Try to push the constant operand into a ZExt: C * zext (A + B) ->
32043204
// zext (C*A + C*B) if trunc (C) * (A + B) does not unsigned-wrap.
32053205
const SCEVAddExpr *InnerAdd;
32063206
if (match(Ops[1], m_scev_ZExt(m_scev_Add(InnerAdd)))) {
@@ -3210,8 +3210,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
32103210
hasFlags(StrengthenNoWrapFlags(this, scMulExpr, {NarrowC, InnerAdd},
32113211
SCEV::FlagAnyWrap),
32123212
SCEV::FlagNUW)) {
3213-
auto *Res =
3214-
getMulExpr(NarrowC, InnerAdd, SCEV::FlagAnyWrap, Depth + 1);
3213+
auto *Res = getMulExpr(NarrowC, InnerAdd, SCEV::FlagNUW, Depth + 1);
32153214
return getZeroExtendExpr(Res, Ops[1]->getType(), Depth + 1);
32163215
};
32173216
}

0 commit comments

Comments
 (0)