Skip to content

Commit 89f01c7

Browse files
toppercakiramenai
authored andcommitted
[SelectionDAG] Use getSignedConstant/getAllOnesConstant.
1 parent 4552a86 commit 89f01c7

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9590,7 +9590,7 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
95909590
// A rotate left of ~1 is a nice way of achieving the desired result.
95919591
if (TLI.isOperationLegalOrCustom(ISD::ROTL, VT) && N0Opcode == ISD::SHL &&
95929592
isAllOnesConstant(N1) && isOneConstant(N0.getOperand(0))) {
9593-
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getConstant(~1, DL, VT),
9593+
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getSignedConstant(~1, DL, VT),
95949594
N0.getOperand(1));
95959595
}
95969596

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3289,7 +3289,7 @@ void DAGTypeLegalizer::ExpandIntRes_MINMAX(SDNode *N,
32893289
SDValue HiNeg =
32903290
DAG.getSetCC(DL, CCT, LHSH, DAG.getConstant(0, DL, NVT), ISD::SETLT);
32913291
if (N->getOpcode() == ISD::SMIN) {
3292-
Lo = DAG.getSelect(DL, NVT, HiNeg, LHSL, DAG.getConstant(-1, DL, NVT));
3292+
Lo = DAG.getSelect(DL, NVT, HiNeg, LHSL, DAG.getAllOnesConstant(DL, NVT));
32933293
} else {
32943294
Lo = DAG.getSelect(DL, NVT, HiNeg, DAG.getConstant(0, DL, NVT), LHSL);
32953295
}

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,9 +2452,9 @@ SDValue SelectionDAG::expandVAArg(SDNode *Node) {
24522452
VAList = getNode(ISD::ADD, dl, VAList.getValueType(), VAList,
24532453
getConstant(MA->value() - 1, dl, VAList.getValueType()));
24542454

2455-
VAList =
2456-
getNode(ISD::AND, dl, VAList.getValueType(), VAList,
2457-
getConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
2455+
VAList = getNode(
2456+
ISD::AND, dl, VAList.getValueType(), VAList,
2457+
getSignedConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
24582458
}
24592459

24602460
// Increment the pointer, VAList, to the next vaarg

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12572,8 +12572,10 @@ void SelectionDAGBuilder::visitVectorSplice(const CallInst &I) {
1257212572

1257312573
// VECTOR_SHUFFLE doesn't support a scalable mask so use a dedicated node.
1257412574
if (VT.isScalableVector()) {
12575-
setValue(&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12576-
DAG.getVectorIdxConstant(Imm, DL)));
12575+
setValue(
12576+
&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12577+
DAG.getSignedConstant(
12578+
Imm, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))));
1257712579
return;
1257812580
}
1257912581

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9060,8 +9060,8 @@ SDValue TargetLowering::expandVPCTLZ(SDNode *Node, SelectionDAG &DAG) const {
90609060
DAG.getNode(ISD::VP_SRL, dl, VT, Op, Tmp, Mask, VL), Mask,
90619061
VL);
90629062
}
9063-
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getConstant(-1, dl, VT), Mask,
9064-
VL);
9063+
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getAllOnesConstant(dl, VT),
9064+
Mask, VL);
90659065
return DAG.getNode(ISD::VP_CTPOP, dl, VT, Op, Mask, VL);
90669066
}
90679067

@@ -9174,7 +9174,7 @@ SDValue TargetLowering::expandVPCTTZ(SDNode *Node, SelectionDAG &DAG) const {
91749174

91759175
// Same as the vector part of expandCTTZ, use: popcount(~x & (x - 1))
91769176
SDValue Not = DAG.getNode(ISD::VP_XOR, dl, VT, Op,
9177-
DAG.getConstant(-1, dl, VT), Mask, VL);
9177+
DAG.getAllOnesConstant(dl, VT), Mask, VL);
91789178
SDValue MinusOne = DAG.getNode(ISD::VP_SUB, dl, VT, Op,
91799179
DAG.getConstant(1, dl, VT), Mask, VL);
91809180
SDValue Tmp = DAG.getNode(ISD::VP_AND, dl, VT, Not, MinusOne, Mask, VL);

0 commit comments

Comments
 (0)