Skip to content

Commit c4abc8d

Browse files
committed
comments
1 parent 1cb7948 commit c4abc8d

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
@@ -15263,13 +15263,13 @@ SDValue DAGCombiner::visitAssertExt(SDNode *N) {
1526315263
}
1526415264

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

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

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

1529415291
return SDValue();

0 commit comments

Comments
 (0)