[clang] [IRGen] Mark pointers as noalias when passing trivial types by value. (PR #131885)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 18 12:08:15 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 04ab8a5fba71f7ec65634cc118dc13798a9037fc fb1120b5a4abd716f6071ce8c7cfc81e725e9030 --extensions cpp,c -- clang/lib/CodeGen/CGCall.cpp clang/test/CodeGen/AArch64/byval-temp.c clang/test/CodeGen/atomic-arm64.c clang/test/CodeGen/attr-noundef.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 434b821ad8..02bd2cfa3f 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2800,7 +2800,8 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
       if (Decl && ((CodeGenOpts.PassByValueIsNoAlias &&
                     Decl->getArgPassingRestrictions() ==
                         RecordArgPassingKind::CanPassInRegs) ||
-                  (!AI.getIndirectByVal() && Context.getTypeDeclType(Decl).isTrivialType(Context))))
+                   (!AI.getIndirectByVal() &&
+                    Context.getTypeDeclType(Decl).isTrivialType(Context))))
         // When calling the function, the pointer passed in will be the only
         // reference to the underlying object. Mark it accordingly.
         Attrs.addAttribute(llvm::Attribute::NoAlias);

``````````

</details>


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


More information about the cfe-commits mailing list