[llvm] 8c4e039 - [LegalizeTypes] Use APInt::getLowBitsSet instead of getAllOnes+zext. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 10 16:57:15 PDT 2024
Author: Craig Topper
Date: 2024-08-10T16:52:33-07:00
New Revision: 8c4e039deece7c08f7a49e1d38decc55fcb71fbd
URL: https://github.com/llvm/llvm-project/commit/8c4e039deece7c08f7a49e1d38decc55fcb71fbd
DIFF: https://github.com/llvm/llvm-project/commit/8c4e039deece7c08f7a49e1d38decc55fcb71fbd.diff
LOG: [LegalizeTypes] Use APInt::getLowBitsSet instead of getAllOnes+zext. NFC
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index ee411a74b2d30..79ff33aa705ef 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -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);
More information about the llvm-commits
mailing list