Skip to content

Commit b13d5df

Browse files
committed
[DAG] ComputeKnownBits - use KnownBits::usub_sat instead of a custom variant
KnownBits::usub_sat is already exhaustively tested in the unit tests
1 parent 1b37e80 commit b13d5df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,9 +3903,9 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
39033903
break;
39043904
}
39053905
case ISD::USUBSAT: {
3906-
// The result of usubsat will never be larger than the LHS.
3907-
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
3908-
Known.Zero.setHighBits(Known2.countMinLeadingZeros());
3906+
Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
3907+
Known2 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
3908+
Known = KnownBits::usub_sat(Known, Known2);
39093909
break;
39103910
}
39113911
case ISD::UMIN: {

0 commit comments

Comments
 (0)