[clang] [clang][RISCV] Fix crash on VLS calling convention (PR #145489)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 6 15:30:54 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,c -- clang/lib/CodeGen/CGCall.cpp clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.c clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index bc7698e64..70123b2c1 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1482,10 +1482,9 @@ void CodeGenFunction::CreateCoercedStore(llvm::Value *Src, Address Dst,
     if (llvm::StructType *DstSTy =
             dyn_cast<llvm::StructType>(Dst.getElementType())) {
       if (llvm::TargetExtType *TupTy = dyn_cast<llvm::TargetExtType>(SrcTy)) {
-        // In RISC-V VLS calling convention, struct of fixed vectors or struct of
-        // array of fixed vector of length >1 might be lowered using vector tuple
-        // type, we consider it as a valid load, e.g.
-        // struct i32x4x2 {
+        // In RISC-V VLS calling convention, struct of fixed vectors or struct
+        // of array of fixed vector of length >1 might be lowered using vector
+        // tuple type, we consider it as a valid load, e.g. struct i32x4x2 {
         //     __attribute__((vector_size(16))) int i;
         //     __attribute__((vector_size(16))) int i;
         // };
@@ -1537,9 +1536,8 @@ void CodeGenFunction::CreateCoercedStore(llvm::Value *Src, Address Dst,
 
       if (SrcTy->isScalableTy()) {
         // In RISC-V VLS calling convention, struct of fixed vector or struct of
-        // fixed vector array of length 1 might be lowered using scalable vector,
-        // we consider it as a valid load, e.g.
-        // struct i32x4 {
+        // fixed vector array of length 1 might be lowered using scalable
+        // vector, we consider it as a valid load, e.g. struct i32x4 {
         //     __attribute__((vector_size(16))) int i;
         // };
         // or

``````````

</details>


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


More information about the cfe-commits mailing list