Skip to content

Commit a744621

Browse files
committed
comments
1 parent d11ba7a commit a744621

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
@@ -15245,13 +15245,13 @@ SDValue DAGCombiner::visitAssertExt(SDNode *N) {
1524515245
}
1524615246

1524715247
if (Opcode == ISD::AssertZext && N0.getOpcode() == ISD::AND &&
15248-
N0.hasOneUse() && isa<ConstantSDNode>(N0.getOperand(1))) {
15248+
isa<ConstantSDNode>(N0.getOperand(1))) {
1524915249
const APInt &Mask = N0.getConstantOperandAPInt(1);
1525015250

1525115251
// If we have (AssertZext (and (AssertSext X, iX), M), iY) and Y is smaller
1525215252
// than X, and the And doesn't change the lower iX bits, we can move the
1525315253
// AssertZext in front of the And and drop the AssertSext.
15254-
if (N0.getOperand(0).getOpcode() == ISD::AssertSext) {
15254+
if (N0.getOperand(0).getOpcode() == ISD::AssertSext && N0.hasOneUse()) {
1525515255
SDValue BigA = N0.getOperand(0);
1525615256
EVT BigA_AssertVT = cast<VTSDNode>(BigA.getOperand(1))->getVT();
1525715257
if (AssertVT.bitsLT(BigA_AssertVT) &&
@@ -15266,11 +15266,8 @@ SDValue DAGCombiner::visitAssertExt(SDNode *N) {
1526615266

1526715267
// Remove AssertZext entirely if the mask guarantees the assertion cannot
1526815268
// fail.
15269-
if (Mask.isMask() && Mask.countr_one() <= AssertVT.getScalarSizeInBits()) {
15270-
SDLoc DL(N);
15271-
return DAG.getNode(ISD::AND, DL, N0.getValueType(), N0.getOperand(0),
15272-
N0.getOperand(1));
15273-
}
15269+
if (Mask.isMask() && Mask.countr_one() <= AssertVT.getScalarSizeInBits())
15270+
return N0;
1527415271
}
1527515272

1527615273
return SDValue();

0 commit comments

Comments
 (0)