[llvm] [RISCV] Teach SelectAddrRegRegScale that ADD is commutable. (PR #149231)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 21:53:26 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/RISCV/RISCVISelDAGToDAG.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index e05b92759..3fc493fb6 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -3036,7 +3036,8 @@ static bool isWorthFoldingSHLOverADDI(SDValue Addi, SDValue Shift,
                                       const RISCVSubtarget &Subtarget) {
   unsigned ShiftAmt = Shift.getConstantOperandVal(1);
 
-  if (ShiftAmt <= 3 && (Subtarget.hasStdExtZba() || Subtarget.hasVendorXTHeadBa()))
+  if (ShiftAmt <= 3 &&
+      (Subtarget.hasStdExtZba() || Subtarget.hasVendorXTHeadBa()))
     return false;
 
   if (ShiftAmt >= 4 && Subtarget.hasVendorXqciac())

``````````

</details>


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


More information about the llvm-commits mailing list