Skip to content

Commit 067f2e9

Browse files
committed
[SelectionDAG] Use getSignedConstant/getAllOnesConstant.
1 parent 8041bf4 commit 067f2e9

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
@@ -9561,7 +9561,7 @@ SDValue DAGCombiner::visitXOR(SDNode *N) {
95619561
// A rotate left of ~1 is a nice way of achieving the desired result.
95629562
if (TLI.isOperationLegalOrCustom(ISD::ROTL, VT) && N0Opcode == ISD::SHL &&
95639563
isAllOnesConstant(N1) && isOneConstant(N0.getOperand(0))) {
9564-
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getConstant(~1, DL, VT),
9564+
return DAG.getNode(ISD::ROTL, DL, VT, DAG.getSignedConstant(~1, DL, VT),
95659565
N0.getOperand(1));
95669566
}
95679567

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3302,7 +3302,7 @@ void DAGTypeLegalizer::ExpandIntRes_MINMAX(SDNode *N,
33023302
SDValue HiNeg =
33033303
DAG.getSetCC(DL, CCT, LHSH, DAG.getConstant(0, DL, NVT), ISD::SETLT);
33043304
if (N->getOpcode() == ISD::SMIN) {
3305-
Lo = DAG.getSelect(DL, NVT, HiNeg, LHSL, DAG.getConstant(-1, DL, NVT));
3305+
Lo = DAG.getSelect(DL, NVT, HiNeg, LHSL, DAG.getAllOnesConstant(DL, NVT));
33063306
} else {
33073307
Lo = DAG.getSelect(DL, NVT, HiNeg, DAG.getConstant(0, DL, NVT), LHSL);
33083308
}

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

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

2446-
VAList =
2447-
getNode(ISD::AND, dl, VAList.getValueType(), VAList,
2448-
getConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
2446+
VAList = getNode(
2447+
ISD::AND, dl, VAList.getValueType(), VAList,
2448+
getSignedConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
24492449
}
24502450

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

1253312533
// VECTOR_SHUFFLE doesn't support a scalable mask so use a dedicated node.
1253412534
if (VT.isScalableVector()) {
12535-
setValue(&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12536-
DAG.getVectorIdxConstant(Imm, DL)));
12535+
setValue(
12536+
&I, DAG.getNode(ISD::VECTOR_SPLICE, DL, VT, V1, V2,
12537+
DAG.getSignedConstant(
12538+
Imm, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))));
1253712539
return;
1253812540
}
1253912541

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9185,8 +9185,8 @@ SDValue TargetLowering::expandVPCTLZ(SDNode *Node, SelectionDAG &DAG) const {
91859185
DAG.getNode(ISD::VP_SRL, dl, VT, Op, Tmp, Mask, VL), Mask,
91869186
VL);
91879187
}
9188-
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getConstant(-1, dl, VT), Mask,
9189-
VL);
9188+
Op = DAG.getNode(ISD::VP_XOR, dl, VT, Op, DAG.getAllOnesConstant(dl, VT),
9189+
Mask, VL);
91909190
return DAG.getNode(ISD::VP_CTPOP, dl, VT, Op, Mask, VL);
91919191
}
91929192

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

93009300
// Same as the vector part of expandCTTZ, use: popcount(~x & (x - 1))
93019301
SDValue Not = DAG.getNode(ISD::VP_XOR, dl, VT, Op,
9302-
DAG.getConstant(-1, dl, VT), Mask, VL);
9302+
DAG.getAllOnesConstant(dl, VT), Mask, VL);
93039303
SDValue MinusOne = DAG.getNode(ISD::VP_SUB, dl, VT, Op,
93049304
DAG.getConstant(1, dl, VT), Mask, VL);
93059305
SDValue Tmp = DAG.getNode(ISD::VP_AND, dl, VT, Not, MinusOne, Mask, VL);

0 commit comments

Comments
 (0)