Skip to content

Commit 8b0edcf

Browse files
committed
Remove redundant DAG.ReplaceAllUsesWith(LHS, ANDSNode) and LHS.getOpcode() == AArch64ISD::ANDS substitutions
We already handle that now elsewhere.
1 parent 8c1aff4 commit 8b0edcf

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,17 +3747,11 @@ static SDValue emitComparison(SDValue LHS, SDValue RHS, ISD::CondCode CC,
37473747
} else if (isNullConstant(RHS) && !isUnsignedIntSetCC(CC)) {
37483748
if (LHS.getOpcode() == ISD::AND) {
37493749
// Similarly, (CMP (and X, Y), 0) can be implemented with a TST
3750-
// (a.k.a. ANDS) except that the flags are only guaranteed to work for one
3751-
// of the signed comparisons.
3752-
const SDValue ANDSNode =
3753-
DAG.getNode(AArch64ISD::ANDS, DL, DAG.getVTList(VT, FlagsVT),
3754-
LHS.getOperand(0), LHS.getOperand(1));
3755-
// Replace all users of (and X, Y) with newly generated (ands X, Y)
3756-
DAG.ReplaceAllUsesWith(LHS, ANDSNode);
3757-
return ANDSNode.getValue(1);
3758-
} else if (LHS.getOpcode() == AArch64ISD::ANDS) {
3759-
// Use result of ANDS
3760-
return LHS.getValue(1);
3750+
// (a.k.a. ANDS) except that the flags are only guaranteed to work for
3751+
// signed comparisons.
3752+
Opcode = AArch64ISD::ANDS;
3753+
RHS = LHS.getOperand(1);
3754+
LHS = LHS.getOperand(0);
37613755
}
37623756
}
37633757

0 commit comments

Comments
 (0)