diff --git a/llvm/test/Analysis/GlobalsModRef/indirect-global.ll b/llvm/test/Analysis/GlobalsModRef/indirect-global.ll --- a/llvm/test/Analysis/GlobalsModRef/indirect-global.ll +++ b/llvm/test/Analysis/GlobalsModRef/indirect-global.ll @@ -9,7 +9,7 @@ @G = internal global i32* null ; [#uses=3] -declare noalias i8* @malloc(i32) +declare noalias i8* @malloc(i32) allockind("alloc,uninitialized") allocsize(0) inaccessiblememonly define void @malloc_init() { ; CHECK-LABEL: @malloc_init( ; CHECK-NEXT: [[A:%.*]] = call dereferenceable_or_null(4) i8* @malloc(i32 4) @@ -38,7 +38,7 @@ @G2 = internal global i32* null ; [#uses=3] -declare noalias i8* @calloc(i32, i32) +declare noalias i8* @calloc(i32, i32) allockind("alloc,zeroed") allocsize(0,1) inaccessiblememonly define void @calloc_init() { ; CHECK-LABEL: @calloc_init( ; CHECK-NEXT: [[A:%.*]] = call dereferenceable_or_null(4) i8* @calloc(i32 4, i32 1) diff --git a/llvm/test/Instrumentation/BoundsChecking/simple.ll b/llvm/test/Instrumentation/BoundsChecking/simple.ll --- a/llvm/test/Instrumentation/BoundsChecking/simple.ll +++ b/llvm/test/Instrumentation/BoundsChecking/simple.ll @@ -6,9 +6,9 @@ @.str_as1 = private addrspace(1) constant [8 x i8] c"abcdefg\00" ; <[8 x i8] addrspace(1)*> -declare noalias i8* @malloc(i64) nounwind -declare noalias i8* @calloc(i64, i64) nounwind -declare noalias i8* @realloc(i8* nocapture, i64) nounwind +declare noalias i8* @malloc(i64) nounwind allocsize(0) +declare noalias i8* @calloc(i64, i64) nounwind allocsize(0,1) +declare noalias i8* @realloc(i8* nocapture allocptr, i64) nounwind allocsize(1) ; CHECK: @f1 define void @f1() nounwind { diff --git a/llvm/test/Transforms/Attributor/heap_to_stack.ll b/llvm/test/Transforms/Attributor/heap_to_stack.ll --- a/llvm/test/Transforms/Attributor/heap_to_stack.ll +++ b/llvm/test/Transforms/Attributor/heap_to_stack.ll @@ -4,7 +4,7 @@ ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) declare void @nocapture_func_frees_pointer(i8* nocapture) @@ -26,7 +26,7 @@ declare i32 @no_return_call() noreturn -declare void @free(i8* nocapture) +declare void @free(i8* nocapture) allockind("free") declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind @@ -45,13 +45,13 @@ ; IS________OPM-NEXT: [[C2:%.*]] = bitcast i32* [[C1]] to i8* ; IS________OPM-NEXT: [[L:%.*]] = load i8, i8* [[C2]], align 16 ; IS________OPM-NEXT: call void @usei8(i8 [[L]]) -; IS________OPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[C2]]) #[[ATTR5:[0-9]+]] +; IS________OPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[C2]]) #[[ATTR9:[0-9]+]] ; IS________OPM-NEXT: br label [[J]] ; IS________OPM: dead: ; IS________OPM-NEXT: unreachable ; IS________OPM: j: ; IS________OPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M]], [[F]] ], [ null, [[F2]] ] -; IS________OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR5]] +; IS________OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR9]] ; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction @@ -66,13 +66,13 @@ ; IS________NPM: f2: ; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M_H2S]], align 16 ; IS________NPM-NEXT: call void @usei8(i8 [[L]]) -; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M_H2S]]) #[[ATTR6:[0-9]+]] +; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M_H2S]]) #[[ATTR10:[0-9]+]] ; IS________NPM-NEXT: br label [[J]] ; IS________NPM: dead: ; IS________NPM-NEXT: unreachable ; IS________NPM: j: ; IS________NPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M_H2S]], [[F]] ], [ null, [[F2]] ] -; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR6]] +; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR10]] ; IS________NPM-NEXT: ret void ; entry: @@ -183,7 +183,7 @@ ret void } -declare noalias i8* @aligned_alloc(i64, i64) +declare noalias i8* @aligned_alloc(i64, i64) allockind("alloc,uninitialized,aligned") allocsize(1) define void @test3b(i8* %p) { ; IS________OPM-LABEL: define {{[^@]+}}@test3b @@ -241,7 +241,7 @@ ret void } -declare noalias i8* @calloc(i64, i64) +declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) define void @test0() { ; IS________OPM-LABEL: define {{[^@]+}}@test0() { @@ -382,12 +382,12 @@ define void @test7() { ; IS________OPM-LABEL: define {{[^@]+}}@test7() { ; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; IS________OPM-NEXT: [[TMP2:%.*]] = tail call i32 @no_return_call() #[[ATTR3:[0-9]+]] +; IS________OPM-NEXT: [[TMP2:%.*]] = tail call i32 @no_return_call() #[[ATTR4:[0-9]+]] ; IS________OPM-NEXT: unreachable ; ; IS________NPM-LABEL: define {{[^@]+}}@test7() { ; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: [[TMP1:%.*]] = tail call i32 @no_return_call() #[[ATTR3:[0-9]+]] +; IS________NPM-NEXT: [[TMP1:%.*]] = tail call i32 @no_return_call() #[[ATTR4:[0-9]+]] ; IS________NPM-NEXT: unreachable ; %1 = tail call noalias i8* @malloc(i64 4) @@ -425,7 +425,7 @@ ; IS________OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) ; IS________OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* ; IS________OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS________OPM-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) #[[ATTR5]] +; IS________OPM-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) #[[ATTR9]] ; IS________OPM-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) ; IS________OPM-NEXT: ret void ; @@ -434,7 +434,7 @@ ; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) ; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* ; IS________NPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS________NPM-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) #[[ATTR6]] +; IS________NPM-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) #[[ATTR10]] ; IS________NPM-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) ; IS________NPM-NEXT: ret void ; @@ -512,13 +512,13 @@ define void @test11() { ; IS________OPM-LABEL: define {{[^@]+}}@test11() { ; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; IS________OPM-NEXT: tail call void @sync_will_return(i8* [[TMP1]]) #[[ATTR5]] +; IS________OPM-NEXT: tail call void @sync_will_return(i8* [[TMP1]]) #[[ATTR9]] ; IS________OPM-NEXT: tail call void @free(i8* nocapture [[TMP1]]) ; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test11() { ; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @sync_will_return(i8* [[DOTH2S]]) #[[ATTR6]] +; IS________NPM-NEXT: tail call void @sync_will_return(i8* [[DOTH2S]]) #[[ATTR10]] ; IS________NPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) @@ -819,7 +819,7 @@ ; IS________OPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) { ; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) ; IS________OPM-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 -; IS________OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) #[[ATTR5]] +; IS________OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) #[[ATTR9]] ; IS________OPM-NEXT: tail call void @free(i8* nocapture [[TMP1]]) ; IS________OPM-NEXT: ret void ; @@ -827,7 +827,7 @@ ; IS________NPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree writeonly [[P:%.*]]) { ; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1 ; IS________NPM-NEXT: store i8* [[DOTH2S]], i8** [[P]], align 8 -; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[DOTH2S]]) #[[ATTR6]] +; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[DOTH2S]]) #[[ATTR10]] ; IS________NPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) @@ -849,18 +849,26 @@ ret void } ;. -; IS________OPM: attributes #[[ATTR0:[0-9]+]] = { nounwind willreturn } -; IS________OPM: attributes #[[ATTR1:[0-9]+]] = { nofree nosync willreturn } -; IS________OPM: attributes #[[ATTR2:[0-9]+]] = { nofree nounwind } -; IS________OPM: attributes #[[ATTR3]] = { noreturn } -; IS________OPM: attributes #[[ATTR4:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } -; IS________OPM: attributes #[[ATTR5]] = { nounwind } +; IS________OPM: attributes #[[ATTR0:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) } +; IS________OPM: attributes #[[ATTR1:[0-9]+]] = { nounwind willreturn } +; IS________OPM: attributes #[[ATTR2:[0-9]+]] = { nofree nosync willreturn } +; IS________OPM: attributes #[[ATTR3:[0-9]+]] = { nofree nounwind } +; IS________OPM: attributes #[[ATTR4]] = { noreturn } +; IS________OPM: attributes #[[ATTR5:[0-9]+]] = { allockind("free") } +; IS________OPM: attributes #[[ATTR6:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } +; IS________OPM: attributes #[[ATTR7:[0-9]+]] = { allockind("alloc,uninitialized,aligned") allocsize(1) } +; IS________OPM: attributes #[[ATTR8:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) } +; IS________OPM: attributes #[[ATTR9]] = { nounwind } ;. -; IS________NPM: attributes #[[ATTR0:[0-9]+]] = { nounwind willreturn } -; IS________NPM: attributes #[[ATTR1:[0-9]+]] = { nofree nosync willreturn } -; IS________NPM: attributes #[[ATTR2:[0-9]+]] = { nofree nounwind } -; IS________NPM: attributes #[[ATTR3]] = { noreturn } -; IS________NPM: attributes #[[ATTR4:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } -; IS________NPM: attributes #[[ATTR5:[0-9]+]] = { argmemonly nofree nounwind willreturn writeonly } -; IS________NPM: attributes #[[ATTR6]] = { nounwind } +; IS________NPM: attributes #[[ATTR0:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) } +; IS________NPM: attributes #[[ATTR1:[0-9]+]] = { nounwind willreturn } +; IS________NPM: attributes #[[ATTR2:[0-9]+]] = { nofree nosync willreturn } +; IS________NPM: attributes #[[ATTR3:[0-9]+]] = { nofree nounwind } +; IS________NPM: attributes #[[ATTR4]] = { noreturn } +; IS________NPM: attributes #[[ATTR5:[0-9]+]] = { allockind("free") } +; IS________NPM: attributes #[[ATTR6:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } +; IS________NPM: attributes #[[ATTR7:[0-9]+]] = { allockind("alloc,uninitialized,aligned") allocsize(1) } +; IS________NPM: attributes #[[ATTR8:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) } +; IS________NPM: attributes #[[ATTR9:[0-9]+]] = { argmemonly nofree nounwind willreturn writeonly } +; IS________NPM: attributes #[[ATTR10]] = { nounwind } ;. diff --git a/llvm/test/Transforms/Attributor/lowerheap.ll b/llvm/test/Transforms/Attributor/lowerheap.ll --- a/llvm/test/Transforms/Attributor/lowerheap.ll +++ b/llvm/test/Transforms/Attributor/lowerheap.ll @@ -6,16 +6,16 @@ declare i64 @subfn(i8*) #0 -declare noalias i8* @malloc(i64) -declare noalias i8* @calloc(i64, i64) -declare void @free(i8*) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" +declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" +declare void @free(i8*) allockind("free") "alloc-family"="malloc" define i64 @f(i64 %len) { ; IS________OPM-LABEL: define {{[^@]+}}@f ; IS________OPM-SAME: (i64 [[LEN:%.*]]) { ; IS________OPM-NEXT: entry: ; IS________OPM-NEXT: [[MEM:%.*]] = call noalias i8* @malloc(i64 [[LEN]]) -; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) #[[ATTR1:[0-9]+]] +; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) #[[ATTR4:[0-9]+]] ; IS________OPM-NEXT: call void @free(i8* [[MEM]]) ; IS________OPM-NEXT: ret i64 [[RES]] ; @@ -23,7 +23,7 @@ ; IS________NPM-SAME: (i64 [[LEN:%.*]]) { ; IS________NPM-NEXT: entry: ; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 [[LEN]], align 1 -; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP0]]) #[[ATTR2:[0-9]+]] +; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP0]]) #[[ATTR5:[0-9]+]] ; IS________NPM-NEXT: ret i64 [[RES]] ; entry: @@ -39,7 +39,7 @@ ; IS________OPM-SAME: (i64 [[LEN:%.*]]) { ; IS________OPM-NEXT: entry: ; IS________OPM-NEXT: [[MEM:%.*]] = call noalias i8* @calloc(i64 [[LEN]], i64 noundef 8) -; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) #[[ATTR1]] +; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) #[[ATTR4]] ; IS________OPM-NEXT: call void @free(i8* [[MEM]]) ; IS________OPM-NEXT: ret i64 [[RES]] ; @@ -49,7 +49,7 @@ ; IS________NPM-NEXT: [[TMP0:%.*]] = mul i64 [[LEN]], 8 ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 [[TMP0]], align 1 ; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP1]], i8 0, i64 [[TMP0]], i1 false) -; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP1]]) #[[ATTR2]] +; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP1]]) #[[ATTR5]] ; IS________NPM-NEXT: ret i64 [[RES]] ; entry: @@ -62,9 +62,15 @@ attributes #0 = { nounwind willreturn } ;. ; IS________OPM: attributes #[[ATTR0:[0-9]+]] = { nounwind willreturn } -; IS________OPM: attributes #[[ATTR1]] = { nounwind } +; IS________OPM: attributes #[[ATTR1:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" } +; IS________OPM: attributes #[[ATTR2:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" } +; IS________OPM: attributes #[[ATTR3:[0-9]+]] = { allockind("free") "alloc-family"="malloc" } +; IS________OPM: attributes #[[ATTR4]] = { nounwind } ;. ; IS________NPM: attributes #[[ATTR0:[0-9]+]] = { nounwind willreturn } -; IS________NPM: attributes #[[ATTR1:[0-9]+]] = { argmemonly nofree nounwind willreturn writeonly } -; IS________NPM: attributes #[[ATTR2]] = { nounwind } +; IS________NPM: attributes #[[ATTR1:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" } +; IS________NPM: attributes #[[ATTR2:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" } +; IS________NPM: attributes #[[ATTR3:[0-9]+]] = { allockind("free") "alloc-family"="malloc" } +; IS________NPM: attributes #[[ATTR4:[0-9]+]] = { argmemonly nofree nounwind willreturn writeonly } +; IS________NPM: attributes #[[ATTR5]] = { nounwind } ;. diff --git a/llvm/test/Transforms/Coroutines/coro-split-00.ll b/llvm/test/Transforms/Coroutines/coro-split-00.ll --- a/llvm/test/Transforms/Coroutines/coro-split-00.ll +++ b/llvm/test/Transforms/Coroutines/coro-split-00.ll @@ -74,8 +74,8 @@ declare i8* @llvm.coro.begin(token, i8*) declare i1 @llvm.coro.end(i8*, i1) -declare noalias i8* @malloc(i32) +declare noalias i8* @malloc(i32) allockind("alloc,uninitialized") "alloc-family"="malloc" declare void @print(i32) -declare void @free(i8*) willreturn +declare void @free(i8*) willreturn allockind("free") "alloc-family"="malloc" !0 = !{i32 846595819, i8** null} diff --git a/llvm/test/Transforms/Coroutines/coro-split-hidden.ll b/llvm/test/Transforms/Coroutines/coro-split-hidden.ll --- a/llvm/test/Transforms/Coroutines/coro-split-hidden.ll +++ b/llvm/test/Transforms/Coroutines/coro-split-hidden.ll @@ -76,6 +76,6 @@ declare i8* @llvm.coro.begin(token, i8*) declare i1 @llvm.coro.end(i8*, i1) -declare noalias i8* @malloc(i32) +declare noalias i8* @malloc(i32) allockind("alloc,uninitialized") declare void @print(i32) -declare void @free(i8*) willreturn +declare void @free(i8*) willreturn allockind("free") diff --git a/llvm/test/Transforms/Coroutines/no-suspend.ll b/llvm/test/Transforms/Coroutines/no-suspend.ll --- a/llvm/test/Transforms/Coroutines/no-suspend.ll +++ b/llvm/test/Transforms/Coroutines/no-suspend.ll @@ -413,8 +413,8 @@ resume { i8*, i32 } %lpval } -declare i8* @malloc(i32) -declare void @free(i8*) willreturn +declare i8* @malloc(i32) allockind("alloc,uninitialized") allocsize(0) +declare void @free(i8*) willreturn allockind("free") declare void @print(i32) declare void @foo() diff --git a/llvm/test/Transforms/DeadStoreElimination/2016-07-17-UseAfterFree.ll b/llvm/test/Transforms/DeadStoreElimination/2016-07-17-UseAfterFree.ll --- a/llvm/test/Transforms/DeadStoreElimination/2016-07-17-UseAfterFree.ll +++ b/llvm/test/Transforms/DeadStoreElimination/2016-07-17-UseAfterFree.ll @@ -23,10 +23,10 @@ } ; Function Attrs: nounwind -declare void @free(i8* nocapture) local_unnamed_addr #0 +declare void @free(i8* nocapture allocptr) local_unnamed_addr #0 ; Function Attrs: argmemonly nounwind declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1 -attributes #0 = { nounwind } +attributes #0 = { nounwind allockind("free")} attributes #1 = { argmemonly nounwind } diff --git a/llvm/test/Transforms/DeadStoreElimination/calloc-store.ll b/llvm/test/Transforms/DeadStoreElimination/calloc-store.ll --- a/llvm/test/Transforms/DeadStoreElimination/calloc-store.ll +++ b/llvm/test/Transforms/DeadStoreElimination/calloc-store.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s -declare noalias i8* @calloc(i64, i64) inaccessiblememonly +declare noalias i8* @calloc(i64, i64) inaccessiblememonly allockind("alloc,zeroed") define i32* @test1() { ; CHECK-LABEL: test1 diff --git a/llvm/test/Transforms/DeadStoreElimination/free.ll b/llvm/test/Transforms/DeadStoreElimination/free.ll --- a/llvm/test/Transforms/DeadStoreElimination/free.ll +++ b/llvm/test/Transforms/DeadStoreElimination/free.ll @@ -3,8 +3,8 @@ target datalayout = "e-p:64:64:64" -declare void @free(i8* nocapture) -declare noalias i8* @malloc(i64) +declare void @free(i8* nocapture) allockind("free") +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") define void @test(i32* %Q, i32* %P) { ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/DeadStoreElimination/multiblock-malloc-free.ll b/llvm/test/Transforms/DeadStoreElimination/multiblock-malloc-free.ll --- a/llvm/test/Transforms/DeadStoreElimination/multiblock-malloc-free.ll +++ b/llvm/test/Transforms/DeadStoreElimination/multiblock-malloc-free.ll @@ -367,9 +367,9 @@ ret %struct.BitfieldStruct* %retval.0 } -attributes #0 = { nofree nounwind allocsize(0) } +attributes #0 = { nofree nounwind allocsize(0) allockind("alloc,uninitialized") } attributes #1 = { nofree nounwind } -attributes #2 = { nounwind } +attributes #2 = { nounwind allockind("free") } attributes #3 = { allocsize(0,1) } attributes #4 = { allocsize(0) } -attributes #5 = { nofree nounwind allocsize(0,1) } +attributes #5 = { nofree nounwind allocsize(0,1) allockind("alloc,zeroed") } diff --git a/llvm/test/Transforms/DeadStoreElimination/operand-bundles.ll b/llvm/test/Transforms/DeadStoreElimination/operand-bundles.ll --- a/llvm/test/Transforms/DeadStoreElimination/operand-bundles.ll +++ b/llvm/test/Transforms/DeadStoreElimination/operand-bundles.ll @@ -42,7 +42,7 @@ ret void } -declare noalias i8* @calloc(i64, i64) inaccessiblememonly +declare noalias i8* @calloc(i64, i64) inaccessiblememonly allockind("alloc,zeroed") define void @test4() { ; CHECK-LABEL: @test4 diff --git a/llvm/test/Transforms/DeadStoreElimination/simple.ll b/llvm/test/Transforms/DeadStoreElimination/simple.ll --- a/llvm/test/Transforms/DeadStoreElimination/simple.ll +++ b/llvm/test/Transforms/DeadStoreElimination/simple.ll @@ -264,9 +264,9 @@ } -declare noalias i8* @malloc(i64) willreturn +declare noalias i8* @malloc(i64) willreturn allockind("alloc,uninitialized") declare noalias i8* @custom_malloc(i32) willreturn -declare noalias i8* @calloc(i32, i32) willreturn +declare noalias i8* @calloc(i32, i32) willreturn allockind("alloc,zeroed") define void @test14(i32* %Q) { ; CHECK-LABEL: @test14( @@ -693,7 +693,7 @@ ret void } -declare void @free(i8* nocapture) +declare void @free(i8* nocapture) allockind("free") ; We cannot remove `store i32 1, i32* %p`, because @unknown_func may unwind ; and the caller may read %p while unwinding. diff --git a/llvm/test/Transforms/GVN/calloc-load-removal.ll b/llvm/test/Transforms/GVN/calloc-load-removal.ll --- a/llvm/test/Transforms/GVN/calloc-load-removal.ll +++ b/llvm/test/Transforms/GVN/calloc-load-removal.ll @@ -1,5 +1,4 @@ ; RUN: opt -S -basic-aa -gvn < %s | FileCheck %s -; RUN: opt -S -basic-aa -gvn -disable-simplify-libcalls < %s | FileCheck %s -check-prefix=CHECK_NO_LIBCALLS ; Check that loads from calloc are recognized as being zero. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -46,4 +45,4 @@ ; CHECK_NO_LIBCALLS: ret i32 % } -declare noalias i8* @calloc(i64, i64) +declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) diff --git a/llvm/test/Transforms/GVN/malloc-load-removal.ll b/llvm/test/Transforms/GVN/malloc-load-removal.ll --- a/llvm/test/Transforms/GVN/malloc-load-removal.ll +++ b/llvm/test/Transforms/GVN/malloc-load-removal.ll @@ -1,11 +1,10 @@ ; RUN: opt -S -basic-aa -gvn < %s | FileCheck %s -; RUN: opt -S -basic-aa -gvn -disable-simplify-libcalls < %s | FileCheck %s -check-prefix=CHECK_NO_LIBCALLS ; PR13694 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0" -declare noalias i8* @malloc(i64) nounwind +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) define noalias i8* @test1() nounwind uwtable ssp { entry: @@ -55,7 +54,7 @@ ; CHECK_NO_LIBCALLS: icmp } -declare noalias i8* @aligned_alloc(i64, i64) nounwind +declare noalias i8* @aligned_alloc(i64 allocalign, i64) nounwind allockind("alloc,uninitialized,aligned") allocsize(1) define noalias i8* @test3() nounwind uwtable ssp { entry: diff --git a/llvm/test/Transforms/GVN/nonescaping-malloc.ll b/llvm/test/Transforms/GVN/nonescaping-malloc.ll --- a/llvm/test/Transforms/GVN/nonescaping-malloc.ll +++ b/llvm/test/Transforms/GVN/nonescaping-malloc.ll @@ -35,7 +35,7 @@ declare i64 @strlen(i8* nocapture) nounwind readonly -declare noalias i8* @malloc(i64) nounwind +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) inaccessiblememonly declare i32 @_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefE(%"struct.llvm::StringMapImpl"*, i64, i64) diff --git a/llvm/test/Transforms/GVN/nonescaping.ll b/llvm/test/Transforms/GVN/nonescaping.ll --- a/llvm/test/Transforms/GVN/nonescaping.ll +++ b/llvm/test/Transforms/GVN/nonescaping.ll @@ -4,8 +4,8 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-apple-darwin10.0" -declare noalias i8* @malloc(i64) nounwind -declare noalias i8* @calloc(i64, i64) +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) inaccessiblememonly +declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) inaccessiblememonly declare noalias i8* @_Znwm(i64) declare void @escape(i8*) diff --git a/llvm/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll b/llvm/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll --- a/llvm/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll +++ b/llvm/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll @@ -23,4 +23,4 @@ ret void } -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") diff --git a/llvm/test/Transforms/GlobalOpt/2021-08-03-StoreOnceLoadMultiCasts.ll b/llvm/test/Transforms/GlobalOpt/2021-08-03-StoreOnceLoadMultiCasts.ll --- a/llvm/test/Transforms/GlobalOpt/2021-08-03-StoreOnceLoadMultiCasts.ll +++ b/llvm/test/Transforms/GlobalOpt/2021-08-03-StoreOnceLoadMultiCasts.ll @@ -40,5 +40,5 @@ ret i32 %1 } -declare noalias align 16 i8* @malloc(i64) +declare noalias align 16 i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) declare void @f1() diff --git a/llvm/test/Transforms/GlobalOpt/calloc-promote.ll b/llvm/test/Transforms/GlobalOpt/calloc-promote.ll --- a/llvm/test/Transforms/GlobalOpt/calloc-promote.ll +++ b/llvm/test/Transforms/GlobalOpt/calloc-promote.ll @@ -45,5 +45,5 @@ ret i32 %res } -declare noalias align 16 i8* @calloc(i64, i64) +declare noalias align 16 i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) declare void @f1() diff --git a/llvm/test/Transforms/GlobalOpt/malloc-promote-1.ll b/llvm/test/Transforms/GlobalOpt/malloc-promote-1.ll --- a/llvm/test/Transforms/GlobalOpt/malloc-promote-1.ll +++ b/llvm/test/Transforms/GlobalOpt/malloc-promote-1.ll @@ -16,7 +16,7 @@ ret void } -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) define i32 @get() { ; CHECK-LABEL: @get( diff --git a/llvm/test/Transforms/GlobalOpt/malloc-promote-2.ll b/llvm/test/Transforms/GlobalOpt/malloc-promote-2.ll --- a/llvm/test/Transforms/GlobalOpt/malloc-promote-2.ll +++ b/llvm/test/Transforms/GlobalOpt/malloc-promote-2.ll @@ -17,7 +17,7 @@ ret void } -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) define void @foo(i64 %Size) nounwind noinline #0 { ; CHECK-LABEL: @foo( diff --git a/llvm/test/Transforms/GlobalOpt/malloc-promote-4.ll b/llvm/test/Transforms/GlobalOpt/malloc-promote-4.ll --- a/llvm/test/Transforms/GlobalOpt/malloc-promote-4.ll +++ b/llvm/test/Transforms/GlobalOpt/malloc-promote-4.ll @@ -58,4 +58,4 @@ ret i32 %1 } -declare dso_local noalias i8* @malloc(i64) +declare dso_local noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) diff --git a/llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll b/llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll --- a/llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll +++ b/llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll @@ -44,5 +44,5 @@ ret i32 %res } -declare noalias align 16 i8* @malloc(i64) +declare noalias align 16 i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) declare void @f1() diff --git a/llvm/test/Transforms/GlobalOpt/malloc-promote-opaque-ptr.ll b/llvm/test/Transforms/GlobalOpt/malloc-promote-opaque-ptr.ll --- a/llvm/test/Transforms/GlobalOpt/malloc-promote-opaque-ptr.ll +++ b/llvm/test/Transforms/GlobalOpt/malloc-promote-opaque-ptr.ll @@ -5,7 +5,7 @@ @g2 = internal global ptr null @g3 = internal global ptr null -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) ;. ; CHECK: @[[G1_BODY_0:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i64 undef diff --git a/llvm/test/Transforms/GlobalOpt/null-check-is-use-pr35760.ll b/llvm/test/Transforms/GlobalOpt/null-check-is-use-pr35760.ll --- a/llvm/test/Transforms/GlobalOpt/null-check-is-use-pr35760.ll +++ b/llvm/test/Transforms/GlobalOpt/null-check-is-use-pr35760.ll @@ -42,6 +42,6 @@ ret void } -declare dso_local noalias i8* @malloc(i64) +declare dso_local noalias i8* @malloc(i64) inaccessiblememonly allockind("alloc,uninitialized") allocsize(0) declare dso_local i32 @puts(i8* nocapture readonly) diff --git a/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll b/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll --- a/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll +++ b/llvm/test/Transforms/InstCombine/alloc-realloc-free.ll @@ -17,8 +17,8 @@ declare void @llvm.dbg.value(metadata, metadata, metadata) #3 attributes #0 = { mustprogress nounwind uwtable willreturn } -attributes #1 = { inaccessiblememonly mustprogress nofree nounwind willreturn } -attributes #2 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn } -attributes #3 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #1 = { inaccessiblememonly mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") "alloc-family"="malloc" } +attributes #2 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn allockind("realloc") "alloc-family"="malloc" } +attributes #3 = { nofree nosync nounwind readnone speculatable willreturn allockind("free") "alloc-family"="malloc" } attributes #4 = { nounwind } diff --git a/llvm/test/Transforms/InstCombine/badmalloc.ll b/llvm/test/Transforms/InstCombine/badmalloc.ll --- a/llvm/test/Transforms/InstCombine/badmalloc.ll +++ b/llvm/test/Transforms/InstCombine/badmalloc.ll @@ -3,8 +3,8 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-apple-darwin10.0" -declare noalias i8* @malloc(i64) nounwind -declare void @free(i8*) +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") "alloc-family"="malloc" +declare void @free(i8*) allockind("free") "alloc-family"="malloc" ; PR5130 define i1 @test1() { diff --git a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll --- a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll +++ b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll @@ -192,12 +192,12 @@ declare void @bury(i32) local_unnamed_addr #2 ; Function Attrs: nounwind allocsize(0) -declare i8* @malloc(i64) +declare i8* @malloc(i64) nounwind allocsize(0) allockind("alloc,uninitialized") "alloc-family"="malloc" declare i8* @get_unknown_buffer() ; Function Attrs: nounwind -declare void @free(i8* nocapture) +declare void @free(i8* nocapture) nounwind allockind("free") "alloc-family"="malloc" ; Function Attrs: nounwind readnone speculatable declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) diff --git a/llvm/test/Transforms/InstCombine/compare-unescaped.ll b/llvm/test/Transforms/InstCombine/compare-unescaped.ll --- a/llvm/test/Transforms/InstCombine/compare-unescaped.ll +++ b/llvm/test/Transforms/InstCombine/compare-unescaped.ll @@ -3,7 +3,7 @@ @gp = global i32* null, align 8 -declare noalias i8* @malloc(i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) define i1 @compare_global_trivialeq() { ; CHECK-LABEL: @compare_global_trivialeq( diff --git a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll --- a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll +++ b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll @@ -3,13 +3,13 @@ ; RUN: opt -mtriple=x86_64-unknown-linux-gnu < %s -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,GNU -declare noalias i8* @malloc(i64) -declare noalias i8* @calloc(i64, i64) -declare noalias i8* @realloc(i8* nocapture, i64) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" +declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" +declare noalias i8* @realloc(i8* nocapture, i64) allockind("realloc") allocsize(1) "alloc-family"="malloc" declare noalias nonnull i8* @_Znam(i64) ; throwing version of 'new' declare noalias nonnull i8* @_Znwm(i64) ; throwing version of 'new' declare noalias i8* @strdup(i8*) -declare noalias i8* @aligned_alloc(i64, i64) +declare noalias i8* @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc" declare noalias align 16 i8* @memalign(i64, i64) ; new[](unsigned int, align_val_t) declare noalias i8* @_ZnajSt11align_val_t(i64 %size, i64 %align) diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -552,7 +552,7 @@ ; CHECK-NEXT: [[T349:%.*]] = getelementptr [[STRUCT_SIGINFO_T:%.*]], %struct.siginfo_t* [[T344]], i64 0, i32 3, i32 0, i32 3, i32 0 ; CHECK-NEXT: [[T349350:%.*]] = bitcast i8** [[T349]] to i32* ; CHECK-NEXT: [[T351:%.*]] = load i32, i32* [[T349350]], align 8 -; CHECK-NEXT: [[T360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[T351]], %struct.__large_struct* elementtype([[STRUCT___LARGE_STRUCT:%.*]]) null, i32 -14, i32 0) #[[ATTR0:[0-9]+]] +; CHECK-NEXT: [[T360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[T351]], %struct.__large_struct* elementtype(%struct.__large_struct) null, i32 -14, i32 0) #[[ATTR0:[0-9]+]] ; CHECK-NEXT: unreachable ; entry: @@ -1313,7 +1313,7 @@ ret i8* %gep } -declare noalias i8* @malloc(i64) nounwind +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) define i32 @test_gep_bitcast_malloc(%struct.A* %a) { ; CHECK-LABEL: @test_gep_bitcast_malloc( diff --git a/llvm/test/Transforms/InstCombine/malloc-free-mismatched.ll b/llvm/test/Transforms/InstCombine/malloc-free-mismatched.ll --- a/llvm/test/Transforms/InstCombine/malloc-free-mismatched.ll +++ b/llvm/test/Transforms/InstCombine/malloc-free-mismatched.ll @@ -3,7 +3,7 @@ define dso_local i32 @_Z6answeri(i32 %0) { ; CHECK-LABEL: @_Z6answeri( -; CHECK-NEXT: [[TMP2:%.*]] = call noalias nonnull dereferenceable(80) i8* @_Znam(i64 80) #[[ATTR1:[0-9]+]] +; CHECK-NEXT: [[TMP2:%.*]] = call noalias nonnull dereferenceable(80) i8* @_Znam(i64 80) #[[ATTR2:[0-9]+]] ; CHECK-NEXT: call void @free(i8* [[TMP2]]) ; CHECK-NEXT: ret i32 42 ; @@ -24,7 +24,7 @@ declare dso_local nonnull i8* @_Znam(i64) #1 ; Function Attrs: nounwind -declare dso_local void @free(i8*) +declare dso_local void @free(i8*) allockind("free") "alloc-family"="malloc" attributes #0 = { builtin allocsize(0) } -attributes #1 = { nobuiltin allocsize(0) } +attributes #1 = { nobuiltin allocsize(0) allockind("alloc,uninitialized") "alloc-family"="_Znam" } diff --git a/llvm/test/Transforms/InstCombine/malloc-free.ll b/llvm/test/Transforms/InstCombine/malloc-free.ll --- a/llvm/test/Transforms/InstCombine/malloc-free.ll +++ b/llvm/test/Transforms/InstCombine/malloc-free.ll @@ -26,10 +26,10 @@ ret i32 0 } -declare noalias i8* @calloc(i32, i32) nounwind -declare noalias i8* @malloc(i32) -declare noalias i8* @aligned_alloc(i32, i32) -declare void @free(i8*) +declare noalias i8* @calloc(i32, i32) nounwind allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" +declare noalias i8* @malloc(i32) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" +declare noalias i8* @aligned_alloc(i32, i32) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc" +declare void @free(i8*) allockind("free") "alloc-family"="malloc" define i1 @foo() { ; CHECK-LABEL: @foo( diff --git a/llvm/test/Transforms/InstCombine/malloc_free_delete_nvptx.ll b/llvm/test/Transforms/InstCombine/malloc_free_delete_nvptx.ll --- a/llvm/test/Transforms/InstCombine/malloc_free_delete_nvptx.ll +++ b/llvm/test/Transforms/InstCombine/malloc_free_delete_nvptx.ll @@ -4,8 +4,8 @@ target triple = "nvptx64" declare void @user(i8*) -declare i8* @malloc(i64) -declare void @free(i8*) +declare i8* @malloc(i64) allockind("alloc,uninitialized") "alloc-family"="malloc" allocsize(0) +declare void @free(i8*) allockind("free") "alloc-family"="malloc" ; Ensure the nvptx backend states malloc & free are a thing so we can recognize ; so we will optimize them properly. In the test below the malloc-free chain is diff --git a/llvm/test/Transforms/InstCombine/objsize-64.ll b/llvm/test/Transforms/InstCombine/objsize-64.ll --- a/llvm/test/Transforms/InstCombine/objsize-64.ll +++ b/llvm/test/Transforms/InstCombine/objsize-64.ll @@ -2,7 +2,7 @@ ; RUN: opt < %s -passes=instcombine -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -declare noalias i8* @malloc(i64) nounwind +declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) declare noalias nonnull i8* @_Znwm(i64) ; new(unsigned long) declare i32 @__gxx_personality_v0(...) declare void @__cxa_call_unexpected(i8*) diff --git a/llvm/test/Transforms/InstCombine/objsize.ll b/llvm/test/Transforms/InstCombine/objsize.ll --- a/llvm/test/Transforms/InstCombine/objsize.ll +++ b/llvm/test/Transforms/InstCombine/objsize.ll @@ -192,7 +192,7 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind -declare noalias i8* @malloc(i32) nounwind +declare noalias i8* @malloc(i32) nounwind allockind("alloc,uninitialized") allocsize(0) define i32 @test7(i8** %esc) { ; CHECK-LABEL: @test7( @@ -207,7 +207,7 @@ ret i32 %objsize } -declare noalias i8* @calloc(i32, i32) nounwind +declare noalias i8* @calloc(i32, i32) nounwind allockind("alloc,zeroed") allocsize(0,1) define i32 @test8(i8** %esc) { ; CHECK-LABEL: @test8( diff --git a/llvm/test/Transforms/InstCombine/realloc-free.ll b/llvm/test/Transforms/InstCombine/realloc-free.ll --- a/llvm/test/Transforms/InstCombine/realloc-free.ll +++ b/llvm/test/Transforms/InstCombine/realloc-free.ll @@ -6,14 +6,15 @@ ; CHECK-NEXT: tail call void @free(i8* [[TMP0:%.*]]) ; CHECK-NEXT: ret void ; - %2 = tail call align 16 dereferenceable_or_null(6) i8* @realloc(i8* %0, i64 6) #2 - tail call void @free(i8* %2) #2 + %2 = tail call align 16 dereferenceable_or_null(6) i8* @realloc(i8* %0, i64 6) #3 + tail call void @free(i8* %2) #3 ret void } declare dso_local noalias noundef i8* @realloc(i8* nocapture, i64 noundef) local_unnamed_addr #1 -declare dso_local void @free(i8* nocapture noundef) local_unnamed_addr #1 +declare dso_local void @free(i8* nocapture noundef) local_unnamed_addr #2 attributes #0 = { mustprogress nounwind uwtable willreturn } -attributes #1 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn } -attributes #2 = { nounwind } +attributes #1 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn allockind("realloc") } +attributes #2 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn allockind("free") } +attributes #3 = { nounwind } diff --git a/llvm/test/Transforms/InstCombine/realloc.ll b/llvm/test/Transforms/InstCombine/realloc.ll --- a/llvm/test/Transforms/InstCombine/realloc.ll +++ b/llvm/test/Transforms/InstCombine/realloc.ll @@ -1,8 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -passes=instcombine -S | FileCheck %s -declare i8* @realloc(i8*, i64) #1 -declare noalias i8* @malloc(i64) #1 +declare i8* @realloc(i8* allocptr, i64) allockind("realloc") allocsize(1) +declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") define i8* @realloc_null_ptr() #0 { diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll --- a/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll +++ b/llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll @@ -5,7 +5,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr +declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr allocsize(0) declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg) @buffer = dso_local global [4 x i8] zeroinitializer, align 1 diff --git a/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll b/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll --- a/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll +++ b/llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll @@ -139,7 +139,7 @@ ret i64 %objsize } -declare i8* @malloc(i64) +declare i8* @malloc(i64) allocsize(0) define i64 @test_objectsize_malloc() { ; CHECK-LABEL: @test_objectsize_malloc( diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy.ll --- a/llvm/test/Transforms/MemCpyOpt/memcpy.ll +++ b/llvm/test/Transforms/MemCpyOpt/memcpy.ll @@ -328,7 +328,7 @@ ret void } -declare noalias i8* @malloc(i32) willreturn +declare noalias i8* @malloc(i32) willreturn allockind("alloc,uninitialized") allocsize(0) ; rdar://11341081 %struct.big = type { [50 x i32] }