[lld] [llvm] [RISCV] Fix alignment when mixing rvc/norvc relax/norelax code (PR #150159)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 07:43:58 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 h,cpp -- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
index 5583a2d73..5095603dc 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -312,9 +312,8 @@ bool RISCVAsmBackend::relaxAlign(MCFragment &F, unsigned &Size) {
   if (!STI->hasFeature(RISCV::FeatureRelax) && !hasRelaxEver(F.getParent()))
     return false;
   unsigned MinNopLen =
-      hasRVCEver(F.getParent()) || STI->hasFeature(RISCV::FeatureStdExtZca)
-          ? 2
-          : 4;
+      hasRVCEver(F.getParent()) || STI->hasFeature(RISCV::FeatureStdExtZca) ? 2
+                                                                            : 4;
   if (F.getAlignment() <= MinNopLen)
     return false;
 

``````````

</details>


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


More information about the llvm-commits mailing list