Skip to content

Commit 72a21ad

Browse files
committed
[CR] ConstantRange::sshl_sat(): check sigdness of the min/max, not ranges
This was pointed out in review, but forgot to stage this change into the commit itself..
1 parent e0ea842 commit 72a21ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/IR/ConstantRange.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,8 +1348,8 @@ ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const {
13481348

13491349
APInt Min = getSignedMin(), Max = getSignedMax();
13501350
APInt ShAmtMin = Other.getUnsignedMin(), ShAmtMax = Other.getUnsignedMax();
1351-
APInt NewL = Min.sshl_sat(isAllNonNegative() ? ShAmtMin : ShAmtMax);
1352-
APInt NewU = Max.sshl_sat(isAllNegative() ? ShAmtMin : ShAmtMax) + 1;
1351+
APInt NewL = Min.sshl_sat(Min.isNonNegative() ? ShAmtMin : ShAmtMax);
1352+
APInt NewU = Max.sshl_sat(Max.isNegative() ? ShAmtMin : ShAmtMax) + 1;
13531353
return getNonEmpty(std::move(NewL), std::move(NewU));
13541354
}
13551355

0 commit comments

Comments
 (0)