Skip to content

Commit 22b8209

Browse files
toppercakiramenai
authored andcommitted
[SelectionDAG] Use getSignedConstant/getAllOnesConstant.
1 parent 267d86c commit 22b8209

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
@@ -9582,7 +9582,7 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
95829582
// A rotate left of ~1 is a nice way of achieving the desired result.
95839583
if (TLI.isOperationLegalOrCustom(ISD::ROTL, VT) && N0Opcode == ISD::SHL &&
95849584
isAllOnesConstant(N1) && isOneConstant(N0.getOperand(0))) {
9585-
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getConstant(~1, DL, VT),
9585+
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getSignedConstant(~1, DL, VT),
95869586
N0.getOperand(1));
95879587
}
95889588

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
@@ -2441,9 +2441,9 @@ SDValue SelectionDAG::expandVAArg(SDNode *Node) {
24412441
VAList = getNode(ISD::ADD, dl, VAList.getValueType(), VAList,
24422442
getConstant(MA->value() - 1, dl, VAList.getValueType()));
24432443

2444-
VAList =
2445-
getNode(ISD::AND, dl, VAList.getValueType(), VAList,
2446-
getConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
2444+
VAList = getNode(
2445+
ISD::AND, dl, VAList.getValueType(), VAList,
2446+
getSignedConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
24472447
}
24482448

24492449
// 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
@@ -12508,8 +12508,10 @@ void SelectionDAGBuilder::visitVectorSplice(const CallInst &I) {
1250812508

1250912509
// VECTOR_SHUFFLE doesn't support a scalable mask so use a dedicated node.
1251012510
if (VT.isScalableVector()) {
12511-
setValue(&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12512-
DAG.getVectorIdxConstant(Imm, DL)));
12511+
setValue(
12512+
&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12513+
DAG.getSignedConstant(
12514+
Imm, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))));
1251312515
return;
1251412516
}
1251512517

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9049,8 +9049,8 @@ SDValue TargetLowering::expandVPCTLZ(SDNode *Node, SelectionDAG &DAG) const {
90499049
DAG.getNode(ISD::VP_SRL, dl, VT, Op, Tmp, Mask, VL), Mask,
90509050
VL);
90519051
}
9052-
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getConstant(-1, dl, VT), Mask,
9053-
VL);
9052+
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getAllOnesConstant(dl, VT),
9053+
Mask, VL);
90549054
return DAG.getNode(ISD::VP_CTPOP, dl, VT, Op, Mask, VL);
90559055
}
90569056

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

91649164
// Same as the vector part of expandCTTZ, use: popcount(~x & (x - 1))
91659165
SDValue Not = DAG.getNode(ISD::VP_XOR, dl, VT, Op,
9166-
DAG.getConstant(-1, dl, VT), Mask, VL);
9166+
DAG.getAllOnesConstant(dl, VT), Mask, VL);
91679167
SDValue MinusOne = DAG.getNode(ISD::VP_SUB, dl, VT, Op,
91689168
DAG.getConstant(1, dl, VT), Mask, VL);
91699169
SDValue Tmp = DAG.getNode(ISD::VP_AND, dl, VT, Not, MinusOne, Mask, VL);

0 commit comments

Comments
 (0)