[llvm-branch-commits] [llvm] RuntimeLibcalls: Add missing attributes to memory and allocator libcalls (PR #240735)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 9 23:16:36 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-mips
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Add the attributes inferLibFuncAttributes would give these functions.
Co-authored-by: Claude Opus 5.5 <noreply@<!-- -->anthropic.com>
---
Patch is 115.90 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/240735.diff
20 Files Affected:
- (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+67-24)
- (modified) llvm/include/llvm/IR/RuntimeLibcallsImpl.td (+12-2)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll (+46-36)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aix.ll (+7-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/amdlibm.ll (+2-2)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/arm64ec.ll (+9-7)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/armpl.ll (+2-2)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/avr.ll (+9-7)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/basic.ll (+11-3)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/bsd.ll (+27-21)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll (+10-10)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/hexagon.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/mips.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/msp430.ll (+9-7)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/ppc.ll (+49-35)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/riscv.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/sparc.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/systemz.ll (+18-14)
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/windows.ll (+36-28)
``````````diff
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 740958cb8b255..41054cdd78a33 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -254,7 +254,12 @@ defvar OutPtrAttrs = [NoAlias, WriteOnly, NonNull];
foreach IntTy = [TypeSuffix<"I32", Int32>, TypeSuffix<"I64", Int64>,
TypeSuffix<"I128", Int128>] in {
def MULO_#IntTy.Suffix
- : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]>;
+ : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemWriteOnly;
+ let ParamAttrs = [[], [], OutPtrAttrs];
+ let ParamPointeeTypes = [NoneType, NoneType, Int];
+ }
}
foreach IntTy = [TypeSuffix<"I8", Int8>, TypeSuffix<"I16", Int16>,
@@ -262,7 +267,7 @@ foreach IntTy = [TypeSuffix<"I8", Int8>, TypeSuffix<"I16", Int16>,
TypeSuffix<"I128", Int128>] in {
def SDIVREM_#IntTy.Suffix
: RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]> {
- let FnAttrs = MathFnAttrs;
+ let FnAttrs = CommonFnAttrs;
let Memory = ArgMemWriteOnly;
let ParamAttrs = [[], [], OutPtrAttrs];
let ParamPointeeTypes = [NoneType, NoneType, IntTy.Type];
@@ -274,7 +279,7 @@ foreach IntTy = [TypeSuffix<"I8", UInt8>, TypeSuffix<"I16", UInt16>,
TypeSuffix<"I128", UInt128>] in {
def UDIVREM_#IntTy.Suffix
: RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]> {
- let FnAttrs = MathFnAttrs;
+ let FnAttrs = CommonFnAttrs;
let Memory = ArgMemWriteOnly;
let ParamAttrs = [[], [], OutPtrAttrs];
let ParamPointeeTypes = [NoneType, NoneType, IntTy.Type];
@@ -317,7 +322,7 @@ def PPCF128 : TypeSuffix<"PPCF128", PPCFP128>;
foreach FPTy = [F32, F64] in {
def SQRT_#FPTy.Suffix : RuntimeLibcall<FPTy.Type, [FPTy.Type]> {
- let FnAttrs = MathFnAttrs;
+ let FnAttrs = CommonFnAttrs;
let Memory = ErrnoMemWriteOnly;
let RetAttrs = [NoFPClassAttr<"fcNegInf | fcNegSubnormal | fcNegNormal">];
}
@@ -706,39 +711,73 @@ foreach FPTy = [F32, F64, F128, PPCF128] in {
}
// Memory
-def MEMCMP : RuntimeLibcall<Int, [Ptr, Ptr, SizeT]>;
-def MEMCPY : RuntimeLibcall<Ptr, [Ptr, Ptr, SizeT]>;
+defvar ReadPtrAttrs = [ReadOnly, CapturesNone];
+
+class MemCmpLibcall : RuntimeLibcall<Int, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemReadOnly;
+ let ParamAttrs = [ReadPtrAttrs, ReadPtrAttrs];
+}
+
+def MEMCMP : MemCmpLibcall;
+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]>;
-def MallocFamily : AllocFamilyAttr<"malloc">;
-
-def MALLOC : RuntimeLibcall<Ptr, [SizeT]> {
+class MallocLibcall<string family> : RuntimeLibcall<Ptr, [SizeT]> {
let FnAttrs = [NoFree, NoUnwind, WillReturn,
AllocKindAttr<"AllocFnKind::Alloc | AllocFnKind::Uninitialized">,
- AllocSizeAttr<0>, MallocFamily];
+ AllocSizeAttr<0>, AllocFamilyAttr<family>];
+ let Memory = InaccessibleOrErrnoMem;
let RetAttrs = [NoAlias, NoUndef];
let ParamAttrs = [[NoUndef]];
}
-def CALLOC : RuntimeLibcall<Ptr, [SizeT, SizeT]> {
+class CallocLibcall<string family> : RuntimeLibcall<Ptr, [SizeT, SizeT]> {
let FnAttrs = [NoFree, NoUnwind, WillReturn,
- AllocKindAttr<"AllocFnKind::Alloc">, AllocSizeAttr<0, "1">,
- MallocFamily];
+ AllocKindAttr<"AllocFnKind::Alloc | AllocFnKind::Zeroed">,
+ AllocSizeAttr<0, "1">, AllocFamilyAttr<family>];
+ let Memory = InaccessibleOrErrnoMem;
let RetAttrs = [NoAlias, NoUndef];
let ParamAttrs = [[NoUndef], [NoUndef]];
}
-def FREE : RuntimeLibcall<Void, [Ptr]> {
+class FreeLibcall<string family> : RuntimeLibcall<Void, [Ptr]> {
let FnAttrs = [NoUnwind, WillReturn, AllocKindAttr<"AllocFnKind::Free">,
- MallocFamily];
+ AllocFamilyAttr<family>];
+ let Memory = InaccessibleOrArgMem;
let ParamAttrs = [[AllocatedPointer, NoUndef, CapturesNone]];
}
-def BZERO : RuntimeLibcall<Void, [Ptr, SizeT]>;
-def STRLEN : RuntimeLibcall<SizeT, [Ptr]>;
+def MALLOC : MallocLibcall<"malloc">;
+def CALLOC : CallocLibcall<"malloc">;
+def FREE : FreeLibcall<"malloc">;
+
+def BZERO : RuntimeLibcall<Void, [Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemWriteOnly;
+ let ParamAttrs = [[WriteOnly, CapturesNone]];
+}
+def STRLEN : RuntimeLibcall<SizeT, [Ptr]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemReadOnly;
+ let ParamAttrs = [ReadPtrAttrs];
+}
// Element-wise unordered-atomic memory of different sizes
foreach MemSize = [1, 2, 4, 8, 16] in {
@@ -1003,8 +1042,12 @@ def ATOF : RuntimeLibcall<Dbl, [Ptr]>;
def ATOI : RuntimeLibcall<Int, [Ptr]>;
def ATOL : RuntimeLibcall<Long, [Ptr]>;
def ATOLL : RuntimeLibcall<LLong, [Ptr]>;
-def BCMP : RuntimeLibcall<Int, [Ptr, Ptr, SizeT]>;
-def BCOPY : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]>;
+def BCMP : MemCmpLibcall;
+def BCOPY : RuntimeLibcall<Void, [Ptr, Ptr, SizeT]> {
+ let FnAttrs = CommonFnAttrs;
+ let Memory = ArgMemOnly;
+ let ParamAttrs = [ReadPtrAttrs, [WriteOnly, CapturesNone]];
+}
def CHMOD : RuntimeLibcall<Int, [Ptr, IntX]>;
def CHOWN : RuntimeLibcall<Int, [Ptr, IntX, IntX]>;
def CLEARERR : RuntimeLibcall<Void, [Ptr]>;
@@ -1234,9 +1277,9 @@ def UNSETENV : RuntimeLibcall<Int, [Ptr]>;
def UTIME : RuntimeLibcall<Int, [Ptr, Ptr]>;
def UTIMES : RuntimeLibcall<Int, [Ptr, Ptr]>;
def VALLOC : RuntimeLibcall<Ptr, [SizeT]>;
-def VEC_CALLOC : RuntimeLibcall<Ptr, [SizeT, SizeT]>;
-def VEC_FREE : RuntimeLibcall<Void, [Ptr]>;
-def VEC_MALLOC : RuntimeLibcall<Ptr, [SizeT]>;
+def VEC_CALLOC : CallocLibcall<"vec_malloc">;
+def VEC_FREE : FreeLibcall<"vec_malloc">;
+def VEC_MALLOC : MallocLibcall<"vec_malloc">;
def VEC_REALLOC : RuntimeLibcall<Ptr, [Ptr, SizeT]>;
def VFPRINTF : RuntimeLibcall<Int, [Ptr, Ptr, Ptr]>;
def VFSCANF : RuntimeLibcall<Int, [Ptr, Ptr, Ptr]>;
diff --git a/llvm/include/llvm/IR/RuntimeLibcallsImpl.td b/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
index 03346b17fece4..46e4cd24ea0d9 100644
--- a/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
+++ b/llvm/include/llvm/IR/RuntimeLibcallsImpl.td
@@ -159,8 +159,18 @@ class MemoryEffects<ModRefInfo mr = ModRef> {
def UnknownMemory : MemoryEffects;
def NoMemory : MemoryEffects<NoModRef>;
+def ArgMemOnly : MemoryEffects<NoModRef> { let ArgMem = ModRef; }
+def ArgMemReadOnly : MemoryEffects<NoModRef> { let ArgMem = Ref; }
def ArgMemWriteOnly : MemoryEffects<NoModRef> { let ArgMem = Mod; }
def ErrnoMemWriteOnly : MemoryEffects<NoModRef> { let ErrnoMem = Mod; }
+def InaccessibleOrErrnoMem : MemoryEffects<NoModRef> {
+ let InaccessibleMem = ModRef;
+ let ErrnoMem = ModRef;
+}
+def InaccessibleOrArgMem : MemoryEffects<NoModRef> {
+ let ArgMem = ModRef;
+ let InaccessibleMem = ModRef;
+}
class ValueAttr<list<AttrProperty> props, string expr>
: Attr<"", IntersectPreserve, props> {
@@ -224,7 +234,7 @@ class MaskedRuntimeLibcall<RuntimeLibcall unmasked, FuncArgType mask>
}
// TODO: NoCallback probably unsafe in general
-defvar MathFnAttrs = [NoCallback, NoFree, NoSync, NoUnwind, WillReturn];
+defvar CommonFnAttrs = [NoCallback, NoFree, NoSync, NoUnwind, WillReturn];
multiclass VectorMathLibcall<string suffix, FuncArgType RetType = NoneType,
list<FuncArgType> ArgTypes = [],
@@ -233,7 +243,7 @@ multiclass VectorMathLibcall<string suffix, FuncArgType RetType = NoneType,
list<FuncArgType> paramPointeeTypes = []> {
defvar VT = !cast<VectorFuncArgType>(suffix);
def _#suffix : RuntimeLibcall<RetType, ArgTypes> {
- let FnAttrs = MathFnAttrs;
+ let FnAttrs = CommonFnAttrs;
let Memory = memory;
let ParamAttrs = paramAttrs;
let ParamPointeeTypes = paramPointeeTypes;
diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
index f2e209fc914aa..a2d07f5ff2d0e 100644
--- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
+++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/aarch64.ll
@@ -323,7 +323,7 @@
; LINUX-NEXT: declare double @__muldf3(double, double)
; LINUX-NEXT: declare i64 @__muldi3(i64, i64)
; LINUX-NEXT: declare signext i16 @__mulhi3(i16 signext, i16 signext)
-; LINUX-NEXT: declare i32 @__mulosi4(i32, i32, ptr)
+; LINUX-NEXT: declare i32 @__mulosi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS:#[0-9]+]]
; LINUX-NEXT: declare signext i8 @__mulqi3(i8 signext, i8 signext)
; LINUX-NEXT: declare float @__mulsf3(float, float)
; LINUX-NEXT: declare i32 @__mulsi3(i32, i32)
@@ -532,9 +532,9 @@
; LINUX-NEXT: declare i64 @lroundf(float)
; LINUX-NEXT: declare i64 @lroundl(fp128)
; 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))
; LINUX-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4))
; LINUX-NEXT: declare fp128 @modfl(fp128, ptr noalias nonnull writeonly align 16 dereferenceable(16))
@@ -595,9 +595,11 @@
; LINUX-NEXT: declare double @trunc(double)
; LINUX-NEXT: declare float @truncf(float)
; LINUX-NEXT: declare fp128 @truncl(fp128)
-; LINUX-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc") allocsize(0,1) "alloc-family"="malloc" }
-; LINUX-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") "alloc-family"="malloc" }
-; LINUX-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }
+; LINUX-NEXT: attributes [[ARGMEM_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
+; 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 [[SQRT_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(errnomem: write) }
; DARWIN: @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global ptr
@@ -910,7 +912,7 @@
; DARWIN-NEXT: declare double @__muldf3(double, double)
; DARWIN-NEXT: declare i64 @__muldi3(i64, i64)
; DARWIN-NEXT: declare signext i16 @__mulhi3(i16 signext, i16 signext)
-; DARWIN-NEXT: declare i32 @__mulosi4(i32, i32, ptr)
+; DARWIN-NEXT: declare i32 @__mulosi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS:#[0-9]+]]
; DARWIN-NEXT: declare signext i8 @__mulqi3(i8 signext, i8 signext)
; DARWIN-NEXT: declare float @__mulsf3(float, float)
; DARWIN-NEXT: declare i32 @__mulsi3(i32, i32)
@@ -1023,7 +1025,7 @@
; DARWIN-NEXT: declare double @atan2(double, double)
; DARWIN-NEXT: declare float @atan2f(float, float)
; DARWIN-NEXT: declare float @atanf(float)
-; DARWIN-NEXT: declare void @bzero(ptr, i64)
+; DARWIN-NEXT: declare void @bzero(ptr writeonly captures(none), i64) [[ARGMEM_WRITE_ATTRS]]
; DARWIN-NEXT: declare void @cabs(...)
; DARWIN-NEXT: declare void @cabsf(...)
; DARWIN-NEXT: declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) [[CALLOC_ATTRS:#[0-9]+]]
@@ -1087,9 +1089,9 @@
; DARWIN-NEXT: declare i64 @lround(double)
; DARWIN-NEXT: declare i64 @lroundf(float)
; 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))
; DARWIN-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4))
; DARWIN-NEXT: declare double @nan(ptr)
@@ -1130,9 +1132,11 @@
; DARWIN-NEXT: declare float @tgammaf(float)
; DARWIN-NEXT: declare double @trunc(double)
; DARWIN-NEXT: declare float @truncf(float)
-; DARWIN-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc") allocsize(0,1) "alloc-family"="malloc" }
-; DARWIN-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") "alloc-family"="malloc" }
-; DARWIN-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }
+; DARWIN-NEXT: attributes [[ARGMEM_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
+; 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 [[SQRT_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(errnomem: write) }
; WINMSVC: @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global ptr
@@ -1446,7 +1450,7 @@
; WINMSVC-NEXT: declare double @__muldf3(double, double)
; WINMSVC-NEXT: declare i64 @__muldi3(i64, i64)
; WINMSVC-NEXT: declare signext i16 @__mulhi3(i16 signext, i16 signext)
-; WINMSVC-NEXT: declare i32 @__mulosi4(i32, i32, ptr)
+; WINMSVC-NEXT: declare i32 @__mulosi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS:#[0-9]+]]
; WINMSVC-NEXT: declare signext i8 @__mulqi3(i8 signext, i8 signext)
; WINMSVC-NEXT: declare float @__mulsf3(float, float)
; WINMSVC-NEXT: declare i32 @__mulsi3(i32, i32)
@@ -1618,9 +1622,9 @@
; WINMSVC-NEXT: declare i32 @lround(double)
; WINMSVC-NEXT: declare i32 @lroundf(float)
; 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))
; WINMSVC-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4))
; WINMSVC-NEXT: declare double @nan(ptr)
@@ -1659,9 +1663,11 @@
; WINMSVC-NEXT: declare float @tgammaf(float)
; WINMSVC-NEXT: declare double @trunc(double)
; WINMSVC-NEXT: declare float @truncf(float)
-; WINMSVC-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc") allocsize(0,1) "alloc-family"="malloc" }
-; WINMSVC-NEXT: attributes [[FREE_ATTRS]] = { nounwind willreturn allockind("free") "alloc-family"="malloc" }
-; WINMSVC-NEXT: attributes [[MALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }
+; WINMSVC-NEXT: attributes [[ARGMEM_WRITE_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
+; 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 [[SQRT_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(errnomem: write) }
; MINGW: @__safestack_unsafe_stack_ptr = external thread_local(initialexec) global ptr
@@ -1975,7 +1981,7 @@
; MINGW-NEXT: declare double @__muldf3(double, double)
; MINGW-NEXT: declare i64 @__muldi3(i64, i64)
; MINGW-NEXT: declare signext i16 @__mulhi3(i16 signext, i16 signext)
-; MINGW-NEXT: declare i32 @__mulosi4(i32, i32, ptr)
+; MINGW-NEXT: declare i32 @__mulosi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[ARGMEM_WRITE_ATTRS:#[0-9]+]]
; MINGW-NEXT: declare signext i8 @__mulqi3(i8 signext, i8 signext)
; MINGW-NEXT: declare float @__mulsf3(float, float)
; MINGW-NEXT: declare i32 @__mulsi3(i32, i32)
@@ -2149,9 +2155,9 @@
; MINGW-NEXT: declare i32 @lround(double)
; MINGW-NEXT: declare i32 @lroundf(float)
; 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))
; MINGW-NEXT: declare float @modff(float, ptr noalias nonnull writeonly align 4 dereferenceable(4))
; MINGW-NEXT: declare double @nan(ptr)
@@ -2192,9 +2198,11 @@
; MINGW-NEXT: declare float @tgammaf(float)
; MINGW-NEXT: declare double @trunc(double)
; MINGW-NEXT: declare float @truncf(float)
-; MINGW-NEXT: attributes [[CALLOC_ATTRS]] = { nofree nounwind willreturn allockind("alloc") allo...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/240735
More information about the llvm-branch-commits
mailing list