[llvm] [AArch64] Remove cmp/cmn "tiebreaker" (PR #191929)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 20:05:08 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64
Author: SiliconA-Z
<details>
<summary>Changes</summary>
We do not need it and it is confusing/misleading in cmp/cmn side-chooser
---
Full diff: https://github.com/llvm/llvm-project/pull/191929.diff
1 Files Affected:
- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+4-6)
``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index ece24767bdbb9..1f2bb86b66725 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -4248,13 +4248,11 @@ static SDValue getAArch64Cmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
// can be turned into:
// cmp w12, w11, lsl #1
if (!isa<ConstantSDNode>(RHS) || !isLegalCmpImmed(RHS->getAsAPIntVal())) {
- bool LHSIsCMN = isCMN(LHS, CC, DAG);
- bool RHSIsCMN = isCMN(RHS, CC, DAG);
- SDValue TheLHS = LHSIsCMN ? LHS.getOperand(1) : LHS;
- SDValue TheRHS = RHSIsCMN ? RHS.getOperand(1) : RHS;
+ SDValue TheLHS = isCMN(LHS, CC, DAG) ? LHS.getOperand(1) : LHS;
+ SDValue TheRHS = isCMN(RHS, CC, DAG) ? RHS.getOperand(1) : RHS;
- if (getCmpOperandFoldingProfit(TheLHS) + (LHSIsCMN ? 1 : 0) >
- getCmpOperandFoldingProfit(TheRHS) + (RHSIsCMN ? 1 : 0)) {
+ if (getCmpOperandFoldingProfit(TheLHS) >
+ getCmpOperandFoldingProfit(TheRHS)) {
std::swap(LHS, RHS);
CC = ISD::getSetCCSwappedOperands(CC);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/191929
More information about the llvm-commits
mailing list