[llvm] [RISCV] Add a pass to remove ADDI by reassociating to fold into load/store address. (PR #127151)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 17:08:53 PST 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 5586541d220ebbe27d8dea039d0165c3b2694b06 294a67864ca1a3627de6bf49397ce6782556997f --extensions cpp,h -- llvm/lib/Target/RISCV/RISCVFoldMemOffset.cpp llvm/lib/Target/RISCV/RISCV.h llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVFoldMemOffset.cpp b/llvm/lib/Target/RISCV/RISCVFoldMemOffset.cpp
index b61eda499f..5c457bbd72 100644
--- a/llvm/lib/Target/RISCV/RISCVFoldMemOffset.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFoldMemOffset.cpp
@@ -223,8 +223,8 @@ bool RISCVFoldMemOffset::foldOffset(
       // If the offset is new or changed, add the destination register to the
       // work list.
       int64_t OffsetVal = Offset.getValue();
-      auto P = RegToOffsetMap.try_emplace(User.getOperand(0).getReg(),
-                                          OffsetVal);
+      auto P =
+          RegToOffsetMap.try_emplace(User.getOperand(0).getReg(), OffsetVal);
       if (P.second) {
         Worklist.push(User.getOperand(0).getReg());
       } else if (P.first->second != OffsetVal) {

``````````

</details>


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


More information about the llvm-commits mailing list