Skip to content

Commit 62775f7

Browse files
committed
comments
1 parent 8c37fe1 commit 62775f7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15264,13 +15264,13 @@ SDValue DAGCombiner::visitAssertExt(SDNode *N) {
1526415264
}
1526515265

1526615266
if (Opcode == ISD::AssertZext && N0.getOpcode() == ISD::AND &&
15267-
N0.hasOneUse() && isa<ConstantSDNode>(N0.getOperand(1))) {
15267+
isa<ConstantSDNode>(N0.getOperand(1))) {
1526815268
const APInt &Mask = N0.getConstantOperandAPInt(1);
1526915269

1527015270
// If we have (AssertZext (and (AssertSext X, iX), M), iY) and Y is smaller
1527115271
// than X, and the And doesn't change the lower iX bits, we can move the
1527215272
// AssertZext in front of the And and drop the AssertSext.
15273-
if (N0.getOperand(0).getOpcode() == ISD::AssertSext) {
15273+
if (N0.getOperand(0).getOpcode() == ISD::AssertSext && N0.hasOneUse()) {
1527415274
SDValue BigA = N0.getOperand(0);
1527515275
EVT BigA_AssertVT = cast<VTSDNode>(BigA.getOperand(1))->getVT();
1527615276
if (AssertVT.bitsLT(BigA_AssertVT) &&
@@ -15285,11 +15285,8 @@ SDValue DAGCombiner::visitAssertExt(SDNode *N) {
1528515285

1528615286
// Remove AssertZext entirely if the mask guarantees the assertion cannot
1528715287
// fail.
15288-
if (Mask.isMask() && Mask.countr_one() <= AssertVT.getScalarSizeInBits()) {
15289-
SDLoc DL(N);
15290-
return DAG.getNode(ISD::AND, DL, N0.getValueType(), N0.getOperand(0),
15291-
N0.getOperand(1));
15292-
}
15288+
if (Mask.isMask() && Mask.countr_one() <= AssertVT.getScalarSizeInBits())
15289+
return N0;
1529315290
}
1529415291

1529515292
return SDValue();

0 commit comments

Comments
 (0)