[llvm] [RISCV] Fold LI 1 / SLLI into BSETI during i64 materialization (PR #142348)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 01:56:06 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/MCTargetDesc/RISCVMatInt.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
index f23912961..323bcfc11 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
@@ -357,7 +357,7 @@ InstSeq generateInstSeq(int64_t Val, const MCSubtargetInfo &STI) {
     // Fold LI 1 + SLLI into BSETI.
     if (Res[0].getOpcode() == RISCV::ADDI && Res[0].getImm() == 1 &&
         Res[1].getOpcode() == RISCV::SLLI) {
-      Res.erase(Res.begin()); // Remove ADDI.
+      Res.erase(Res.begin());                                 // Remove ADDI.
       Res.front() = Inst(RISCV::BSETI, Res.front().getImm()); // Patch SLLI.
     }
   }

``````````

</details>


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


More information about the llvm-commits mailing list