[llvm] [AArch64] Prefer comparison with 0 with checking sign flag only (PR #153511)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 13 17:24:30 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 5070508a0..7606e06ba 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -3961,8 +3961,10 @@ static unsigned getCmpOperandFoldingProfit(SDValue Op) {
 static bool shouldBeAdjustedToZero(SDValue LHS, APInt C, ISD::CondCode &CC) {
   // Only works for ANDS and AND.
 
-  // TODO: Is this too restrictive? This is just to prevent CSE with other comparisons.
-  if (LHS.getOpcode() != ISD::AND && LHS.getOpcode() != AArch64ISD::ANDS && !LHS.hasOneUse())
+  // TODO: Is this too restrictive? This is just to prevent CSE with other
+  // comparisons.
+  if (LHS.getOpcode() != ISD::AND && LHS.getOpcode() != AArch64ISD::ANDS &&
+      !LHS.hasOneUse())
     return false;
 
   if (C.isAllOnes() && (CC == ISD::SETLE || CC == ISD::SETGT)) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/153511


More information about the llvm-commits mailing list