Skip to content

Commit ad4cef7

Browse files
committed
Fix comment
Clarify NUW is needed
1 parent 0c92bd2 commit ad4cef7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
14181418
if (BitWidth > 2 && ShAmtC * 2 == BitWidth)
14191419
return BinaryOperator::CreateAnd(X, ConstantInt::get(Ty, *MulC - 2));
14201420

1421-
// lshr (mul (X, 2^N + 1)), N -> add (X, lshr(X, N))
1421+
// lshr (mul nuw (X, 2^N + 1)), N -> add nuw (X, lshr(X, N))
14221422
if (Op0->hasOneUse()) {
14231423
auto *NewAdd = BinaryOperator::CreateNUWAdd(
14241424
X, Builder.CreateLShr(X, ConstantInt::get(Ty, ShAmtC), "",

0 commit comments

Comments
 (0)