[llvm-branch-commits] [llvm] RuntimeLibcalls: Add attributes to memcpy, memmove and memset (PR #241666)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Nov 11 20:46:21 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-mips
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Annotate memcpy, memmove and memset with the attributes
inferLibFuncAttributes gives them. Also handle the __aeabi variants,
which aren't exactly the same.
Co-authored-by: Claude Opus 5.5 <noreply@<!-- -->anthropic.com>
---
Patch is 76.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/241666.diff
18 Files Affected:
- (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+38-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll (+20-15)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll (+4-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/avr.ll (+4-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/basic.ll (+4)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/bsd.ll (+12-9)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/codegen-opt-flags.ll (+7-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/hexagon.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/m68k.ll (+4-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/mips.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/msp430.ll (+4-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/ppc.ll (+14-11)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/riscv.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/sparc.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/systemz.ll (+8-6)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/ve.ll (+4-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/windows.ll (+16-12)
``````````diff
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 15c258275a131..01166f68b95a7 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -738,11 +738,27 @@ class MemCmpLibcall : RuntimeLibcall<Int, [Ptr, Ptr, SizeT]> {
}
def MEMCMP : MemCmpLibcall;
-def MEMCPY : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT]>;
+def MEMCPY : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemOnly;
+ let ParamAttrs = [[NoAlias, Returned, WriteOnly],
+ [NoAlias, ReadOnly, CapturesNone]];
+}
+
def MEMCPY_CHK : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT, SizeT]>;
-def MEMMOVE : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT]>;
+def MEMMOVE : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemOnly;
+ let ParamAttrs = [[Returned, WriteOnly], ReadPtrAttrs];
+}
+
def MEMMOVE_CHK : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT, SizeT]>;
-def MEMSET : RuntimeLibcall<Ptr, [Ptr, Int, SizeT]>;
+def MEMSET : RuntimeLibcall<Ptr, [Ptr, Int, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemWriteOnly;
+ let ParamAttrs = [[Returned, WriteOnly]];
+}
+
def MEMSET_CHK : RuntimeLibcall<Ptr, [Ptr, Int, SizeT, SizeT]>;
class MallocLibcall<string family> : RuntimeLibcall<Ptr, [SizeT]> {
let FnAttrs = [NoFree, NoUnwind, WillReturn,
@@ -995,9 +1011,25 @@ def SMEABI_SME_RESTORE : RuntimeLibcall<Void, [Ptr]>;
// ARM EABI calls
// The AEABI memory functions (RTABI section 5.3.4) return void, and
// __aeabi_memset takes (dest, n, c).
-def AEABI_MEMCPY : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>;
-def AEABI_MEMMOVE : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>;
-def AEABI_MEMSET : RuntimeLibcall<Void, [Ptr, SizeT, Int]>;
+def AEABI_MEMCPY : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemOnly;
+ let ParamAttrs = [[NoAlias, WriteOnly, CapturesNone],
+ [NoAlias, ReadOnly, CapturesNone]];
+}
+
+def AEABI_MEMMOVE : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemOnly;
+ let ParamAttrs = [[WriteOnly, CapturesNone], [ReadOnly, CapturesNone]];
+}
+
+def AEABI_MEMSET : RuntimeLibcall<Void, [Ptr, SizeT, Int]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemWriteOnly;
+ let ParamAttrs = [[WriteOnly, CapturesNone]];
+}
+
def AEABI_MEMCPY4 : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>; // Align 4
def AEABI_MEMCPY8 : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>; // Align 8
def AEABI_MEMMOVE4 : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>;
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
index c1908ce9ff5e3..83e3ad1e70354 100644
--- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
@@ -532,9 +532,9 @@
; LINUX-NEXT: declare i64 @lroundf(float) [[SQRT_ATTRS]]
; LINUX-NEXT: declare i64 @lroundl(fp128) [[SQRT_ATTRS]]
; LINUX-NEXT: declare noalias noundef ptr @malloc(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; LINUX-NEXT: declare ptr @memcpy(ptr, ptr, i64)
-; LINUX-NEXT: declare ptr @memmove(ptr, ptr, i64)
-; LINUX-NEXT: declare ptr @memset(ptr, i32, i64)
+; LINUX-NEXT: declare ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; LINUX-NEXT: declare ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; LINUX-NEXT: declare ptr @memset(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; LINUX-NEXT: declare double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; LINUX-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; LINUX-NEXT: declare fp128 @modfl(fp128, ptr noalias nonnull writeonly align 16 dereferenceable(16)) [[ARGMEM_WRITE_ATTRS]]
@@ -602,6 +602,7 @@
; LINUX-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; LINUX-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; LINUX-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; LINUX-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; LINUX-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; LINUX-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
@@ -1092,9 +1093,9 @@
; DARWIN-NEXT: declare i64 @lround(double) [[SQRT_ATTRS]]
; DARWIN-NEXT: declare i64 @lroundf(float) [[SQRT_ATTRS]]
; DARWIN-NEXT: declare noalias noundef ptr @malloc(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; DARWIN-NEXT: declare ptr @memcpy(ptr, ptr, i64)
-; DARWIN-NEXT: declare ptr @memmove(ptr, ptr, i64)
-; DARWIN-NEXT: declare ptr @memset(ptr, i32, i64)
+; DARWIN-NEXT: declare ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; DARWIN-NEXT: declare ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; DARWIN-NEXT: declare ptr @memset(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; DARWIN-NEXT: declare double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; DARWIN-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; DARWIN-NEXT: declare nofpclass(snan inf zero sub norm) double @nan(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -1142,6 +1143,7 @@
; DARWIN-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; DARWIN-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; DARWIN-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; DARWIN-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; DARWIN-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; DARWIN-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
@@ -1628,9 +1630,9 @@
; WINMSVC-NEXT: declare i32 @lround(double) [[SQRT_ATTRS]]
; WINMSVC-NEXT: declare i32 @lroundf(float) [[SQRT_ATTRS]]
; WINMSVC-NEXT: declare noalias noundef ptr @malloc(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; WINMSVC-NEXT: declare ptr @memcpy(ptr, ptr, i64)
-; WINMSVC-NEXT: declare ptr @memmove(ptr, ptr, i64)
-; WINMSVC-NEXT: declare ptr @memset(ptr, i32, i64)
+; WINMSVC-NEXT: declare ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; WINMSVC-NEXT: declare ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; WINMSVC-NEXT: declare ptr @memset(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; WINMSVC-NEXT: declare double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; WINMSVC-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; WINMSVC-NEXT: declare nofpclass(snan inf zero sub norm) double @nan(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -1675,6 +1677,7 @@
; WINMSVC-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; WINMSVC-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; WINMSVC-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; WINMSVC-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; WINMSVC-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; WINMSVC-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
@@ -2163,9 +2166,9 @@
; MINGW-NEXT: declare i32 @lround(double) [[SQRT_ATTRS]]
; MINGW-NEXT: declare i32 @lroundf(float) [[SQRT_ATTRS]]
; MINGW-NEXT: declare noalias noundef ptr @malloc(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; MINGW-NEXT: declare ptr @memcpy(ptr, ptr, i64)
-; MINGW-NEXT: declare ptr @memmove(ptr, ptr, i64)
-; MINGW-NEXT: declare ptr @memset(ptr, i32, i64)
+; MINGW-NEXT: declare ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; MINGW-NEXT: declare ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; MINGW-NEXT: declare ptr @memset(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; MINGW-NEXT: declare double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; MINGW-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; MINGW-NEXT: declare nofpclass(snan inf zero sub norm) double @nan(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -2213,6 +2216,7 @@
; MINGW-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; MINGW-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; MINGW-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; MINGW-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; MINGW-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; MINGW-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
@@ -2741,9 +2745,9 @@
; ANDROID-NEXT: declare i64 @lroundf(float) [[SQRT_ATTRS]]
; ANDROID-NEXT: declare i64 @lroundl(fp128) [[SQRT_ATTRS]]
; ANDROID-NEXT: declare noalias noundef ptr @malloc(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; ANDROID-NEXT: declare ptr @memcpy(ptr, ptr, i64)
-; ANDROID-NEXT: declare ptr @memmove(ptr, ptr, i64)
-; ANDROID-NEXT: declare ptr @memset(ptr, i32, i64)
+; ANDROID-NEXT: declare ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; ANDROID-NEXT: declare ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; ANDROID-NEXT: declare ptr @memset(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; ANDROID-NEXT: declare double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; ANDROID-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; ANDROID-NEXT: declare fp128 @modfl(fp128, ptr noalias nonnull writeonly align 16 dereferenceable(16)) [[ARGMEM_WRITE_ATTRS]]
@@ -2811,5 +2815,6 @@
; ANDROID-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; ANDROID-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; ANDROID-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; ANDROID-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; ANDROID-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; ANDROID-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll
index 36018ce18fcba..b5b8fd5a4316e 100644
--- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll
@@ -430,9 +430,9 @@
; SJLJ-NEXT: declare arm_aapcscc i32 @lround(double) [[SQRT_ATTRS]]
; SJLJ-NEXT: declare arm_aapcscc i32 @lroundf(float) [[SQRT_ATTRS]]
; SJLJ-NEXT: declare arm_aapcscc noalias noundef ptr @malloc(i32 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; SJLJ-NEXT: declare arm_aapcscc ptr @memcpy(ptr, ptr, i32)
-; SJLJ-NEXT: declare arm_aapcscc ptr @memmove(ptr, ptr, i32)
-; SJLJ-NEXT: declare arm_aapcscc ptr @memset(ptr, i32, i32)
+; SJLJ-NEXT: declare arm_aapcscc ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i32) [[ARGMEM_ATTRS:#[0-9]+]]
+; SJLJ-NEXT: declare arm_aapcscc ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i32) [[ARGMEM_ATTRS]]
+; SJLJ-NEXT: declare arm_aapcscc ptr @memset(ptr returned writeonly, i32, i32) [[ARGMEM_WRITE_ATTRS]]
; SJLJ-NEXT: declare arm_aapcscc double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; SJLJ-NEXT: declare arm_aapcscc float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; SJLJ-NEXT: declare arm_aapcscc nofpclass(snan inf zero sub norm) double @nan(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -480,6 +480,7 @@
; SJLJ-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; SJLJ-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; SJLJ-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; SJLJ-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; SJLJ-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; SJLJ-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
@@ -906,9 +907,9 @@
; DWARF-NEXT: declare arm_aapcscc i32 @lround(double) [[SQRT_ATTRS]]
; DWARF-NEXT: declare arm_aapcscc i32 @lroundf(float) [[SQRT_ATTRS]]
; DWARF-NEXT: declare arm_aapcscc noalias noundef ptr @malloc(i32 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; DWARF-NEXT: declare arm_aapcscc ptr @memcpy(ptr, ptr, i32)
-; DWARF-NEXT: declare arm_aapcscc ptr @memmove(ptr, ptr, i32)
-; DWARF-NEXT: declare arm_aapcscc ptr @memset(ptr, i32, i32)
+; DWARF-NEXT: declare arm_aapcscc ptr @memcpy(ptr noalias returned writeonly, ptr noalias readonly captures(none), i32) [[ARGMEM_ATTRS:#[0-9]+]]
+; DWARF-NEXT: declare arm_aapcscc ptr @memmove(ptr returned writeonly, ptr readonly captures(none), i32) [[ARGMEM_ATTRS]]
+; DWARF-NEXT: declare arm_aapcscc ptr @memset(ptr returned writeonly, i32, i32) [[ARGMEM_WRITE_ATTRS]]
; DWARF-NEXT: declare arm_aapcscc double @modf(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; DWARF-NEXT: declare arm_aapcscc float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; DWARF-NEXT: declare arm_aapcscc nofpclass(snan inf zero sub norm) double @nan(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -956,5 +957,6 @@
; DWARF-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; DWARF-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; DWARF-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; DWARF-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; DWARF-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; DWARF-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll
index 7599166de8a06..97e3e408660bd 100644
--- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll
@@ -474,9 +474,9 @@
; CHECK-NEXT: declare i32 @"#lround"(double) [[SQRT_ATTRS]]
; CHECK-NEXT: declare i32 @"#lroundf"(float) [[SQRT_ATTRS]]
; CHECK-NEXT: declare noalias noundef ptr @"#malloc"(i64 noundef) [[MALLOC_ATTRS:#[0-9]+]]
-; CHECK-NEXT: declare ptr @"#memcpy"(ptr, ptr, i64)
-; CHECK-NEXT: declare ptr @"#memmove"(ptr, ptr, i64)
-; CHECK-NEXT: declare ptr @"#memset"(ptr, i32, i64)
+; CHECK-NEXT: declare ptr @"#memcpy"(ptr noalias returned writeonly, ptr noalias readonly captures(none), i64) [[ARGMEM_ATTRS:#[0-9]+]]
+; CHECK-NEXT: declare ptr @"#memmove"(ptr returned writeonly, ptr readonly captures(none), i64) [[ARGMEM_ATTRS]]
+; CHECK-NEXT: declare ptr @"#memset"(ptr returned writeonly, i32, i64) [[ARGMEM_WRITE_ATTRS]]
; CHECK-NEXT: declare double @"#modf"(double, ptr noalias nonnull writeonly align 8 dereferenceable(8)) [[ARGMEM_WRITE_ATTRS]]
; CHECK-NEXT: declare float @"#modff"(float, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS]]
; CHECK-NEXT: declare nofpclass(snan inf zero sub norm) double @"#nan"(ptr readonly captures(none)) [[ARGMEM_READ_ATTRS:#[0-9]+]]
@@ -521,5 +521,6 @@
; CHECK-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
; CHECK-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
; CHECK-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite, errnomem: readwrite) "alloc-family"="malloc" }
+; CHECK-NEXT: attributes [[ARGMEM_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; CHECK-NEXT: attributes [[ARGMEM_READ_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
; CHECK-NEXT: attributes [[ARGMEM_ERRNO_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write, errnomem: write) }
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/avr.ll ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/241666
More information about the llvm-branch-commits
mailing list