Skip to content

Commit d52fc5a

Browse files
committed
[ValueTracking] Fix a bug for signed min-max clamping
This is the fix of the bug present in PR 120576.
1 parent bc797a9 commit d52fc5a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,7 @@ static void unionWithMinMaxIntrinsicClamp(const IntrinsicInst *II,
11191119
KnownBits &Known) {
11201120
const APInt *CLow, *CHigh;
11211121
if (isSignedMinMaxIntrinsicClamp(II, CLow, CHigh))
1122-
if (!(CLow->isMinSignedValue() && CHigh->isMaxSignedValue()))
1123-
Known = Known.unionWith(ConstantRange(*CLow, *CHigh + 1).toKnownBits());
1122+
Known = Known.unionWith(ConstantRange::getNonEmpty(*CLow, *CHigh + 1).toKnownBits());
11241123
}
11251124

11261125
static void computeKnownBitsFromOperator(const Operator *I,

0 commit comments

Comments
 (0)