Skip to content

Commit

Permalink
[LegalizeTypes] Use APInt::getLowBitsSet instead of getAllOnes+zext. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
topperc committed Aug 10, 2024
1 parent b728f37 commit 8c4e039
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_ADDSUBSHLSAT(SDNode *N) {
unsigned NewBits = PromotedType.getScalarSizeInBits();

if (Opcode == ISD::UADDSAT) {
APInt MaxVal = APInt::getAllOnes(OldBits).zext(NewBits);
APInt MaxVal = APInt::getLowBitsSet(NewBits, OldBits);
SDValue SatMax = DAG.getConstant(MaxVal, dl, PromotedType);
SDValue Add =
matcher.getNode(ISD::ADD, dl, PromotedType, Op1Promoted, Op2Promoted);
Expand Down

0 comments on commit 8c4e039

Please sign in to comment.