Skip to content

Commit

Permalink
[DAG] ComputeKnownBits - use KnownBits::usub_sat instead of a custom …
Browse files Browse the repository at this point in the history
…variant

KnownBits::usub_sat is already exhaustively tested in the unit tests
  • Loading branch information
RKSimon committed Jan 28, 2024
1 parent 1b37e80 commit b13d5df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3903,9 +3903,9 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
break;
}
case ISD::USUBSAT: {
// The result of usubsat will never be larger than the LHS.
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
Known.Zero.setHighBits(Known2.countMinLeadingZeros());
Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
Known2 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
Known = KnownBits::usub_sat(Known, Known2);
break;
}
case ISD::UMIN: {
Expand Down

0 comments on commit b13d5df

Please sign in to comment.