tests: add attributes that would normally come from inferattrs
As my goal is to remove at least _some_ functions from the static list in MemoryBuiltins.cpp, these tests either need to run inferattrs or statically declare these attributes to keep passing. A couple of tests had alternate cases which are no longer meaningful, e.g. `malloc-load-removal.ll`. Differential Revision: https://reviews.llvm.org/D123087
This commit is contained in:
parent
cdf8c7b1af
commit
12c0bf8ba9
|
@ -9,7 +9,7 @@ target datalayout = "p:32:32:32"
|
|||
|
||||
@G = internal global i32* null ; <i32**> [#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 @@ define i32 @malloc_test(i32* %P) {
|
|||
|
||||
@G2 = internal global i32* null ; <i32**> [#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)
|
||||
|
|
|
@ -6,9 +6,9 @@ target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
|
|||
@.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 {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
|
||||
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
|
||||
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
|
||||
; 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 void @usei8(i8)
|
|||
|
||||
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
|
||||
|
||||
|
@ -46,13 +46,13 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) {
|
|||
; 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
|
||||
|
@ -68,13 +68,13 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) {
|
|||
; IS________NPM: f2:
|
||||
; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M]], 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]]) #[[ATTR6:[0-9]+]]
|
||||
; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M]]) #[[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]], [[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:
|
||||
|
@ -185,7 +185,7 @@ define void @test3a(i8* %p) {
|
|||
ret void
|
||||
}
|
||||
|
||||
declare noalias i8* @aligned_alloc(i64, i64)
|
||||
declare noalias i8* @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1)
|
||||
|
||||
define void @test3b(i8* %p) {
|
||||
; IS________OPM-LABEL: define {{[^@]+}}@test3b
|
||||
|
@ -243,7 +243,7 @@ define void @test3d(i8* %p) {
|
|||
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() {
|
||||
|
@ -266,15 +266,10 @@ define void @test0() {
|
|||
|
||||
; TEST 4
|
||||
define void @test4() {
|
||||
; IS________OPM-LABEL: define {{[^@]+}}@test4() {
|
||||
; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
|
||||
; IS________OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP1]])
|
||||
; IS________OPM-NEXT: ret void
|
||||
;
|
||||
; IS________NPM-LABEL: define {{[^@]+}}@test4() {
|
||||
; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1
|
||||
; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[DOTH2S]])
|
||||
; IS________NPM-NEXT: ret void
|
||||
; CHECK-LABEL: define {{[^@]+}}@test4() {
|
||||
; CHECK-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1
|
||||
; CHECK-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[DOTH2S]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%1 = tail call noalias i8* @malloc(i64 4)
|
||||
tail call void @nofree_func(i8* %1)
|
||||
|
@ -384,12 +379,12 @@ define void @test6(i32) {
|
|||
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)
|
||||
|
@ -427,7 +422,7 @@ define void @test9() {
|
|||
; 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
|
||||
;
|
||||
|
@ -436,7 +431,7 @@ define void @test9() {
|
|||
; 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
|
||||
;
|
||||
|
@ -514,13 +509,13 @@ define i32 @test_lifetime() {
|
|||
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)
|
||||
|
@ -557,11 +552,10 @@ define i32 @irreducible_cfg(i32 %0) {
|
|||
; IS________OPM-NEXT: [[TMP14]] = add nsw i32 [[DOT1]], 1
|
||||
; IS________OPM-NEXT: br label [[TMP8]]
|
||||
; IS________OPM: 15:
|
||||
; IS________OPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP3]], align 4
|
||||
; IS________OPM-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP3]] to i8*
|
||||
; IS________OPM-NEXT: call void @free(i8* nocapture noundef [[TMP17]])
|
||||
; IS________OPM-NEXT: [[TMP18:%.*]] = load i32, i32* [[TMP3]], align 4
|
||||
; IS________OPM-NEXT: ret i32 [[TMP18]]
|
||||
; IS________OPM-NEXT: [[TMP16:%.*]] = bitcast i32* [[TMP3]] to i8*
|
||||
; IS________OPM-NEXT: call void @free(i8* nocapture noundef [[TMP16]])
|
||||
; IS________OPM-NEXT: [[TMP17:%.*]] = load i32, i32* [[TMP3]], align 4
|
||||
; IS________OPM-NEXT: ret i32 [[TMP17]]
|
||||
;
|
||||
; IS________NPM-LABEL: define {{[^@]+}}@irreducible_cfg
|
||||
; IS________NPM-SAME: (i32 [[TMP0:%.*]]) {
|
||||
|
@ -631,43 +625,24 @@ define i32 @irreducible_cfg(i32 %0) {
|
|||
|
||||
|
||||
define i32 @malloc_in_loop(i32 %0) {
|
||||
; IS________OPM-LABEL: define {{[^@]+}}@malloc_in_loop
|
||||
; IS________OPM-SAME: (i32 [[TMP0:%.*]]) {
|
||||
; IS________OPM-NEXT: [[TMP2:%.*]] = alloca i32, align 4
|
||||
; IS________OPM-NEXT: [[TMP3:%.*]] = alloca i32*, align 8
|
||||
; IS________OPM-NEXT: store i32 [[TMP0]], i32* [[TMP2]], align 4
|
||||
; IS________OPM-NEXT: br label [[TMP4:%.*]]
|
||||
; IS________OPM: 4:
|
||||
; IS________OPM-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP2]], align 4
|
||||
; IS________OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP5]], -1
|
||||
; IS________OPM-NEXT: store i32 [[TMP6]], i32* [[TMP2]], align 4
|
||||
; IS________OPM-NEXT: [[TMP7:%.*]] = icmp sgt i32 [[TMP6]], 0
|
||||
; IS________OPM-NEXT: br i1 [[TMP7]], label [[TMP8:%.*]], label [[TMP11:%.*]]
|
||||
; IS________OPM: 8:
|
||||
; IS________OPM-NEXT: [[TMP9:%.*]] = call noalias i8* @malloc(i64 noundef 4)
|
||||
; IS________OPM-NEXT: [[TMP10:%.*]] = bitcast i8* [[TMP9]] to i32*
|
||||
; IS________OPM-NEXT: br label [[TMP4]]
|
||||
; IS________OPM: 11:
|
||||
; IS________OPM-NEXT: ret i32 5
|
||||
;
|
||||
; IS________NPM-LABEL: define {{[^@]+}}@malloc_in_loop
|
||||
; IS________NPM-SAME: (i32 [[TMP0:%.*]]) {
|
||||
; IS________NPM-NEXT: [[TMP2:%.*]] = alloca i32, align 4
|
||||
; IS________NPM-NEXT: [[TMP3:%.*]] = alloca i32*, align 8
|
||||
; IS________NPM-NEXT: store i32 [[TMP0]], i32* [[TMP2]], align 4
|
||||
; IS________NPM-NEXT: br label [[TMP4:%.*]]
|
||||
; IS________NPM: 4:
|
||||
; IS________NPM-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP2]], align 4
|
||||
; IS________NPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP5]], -1
|
||||
; IS________NPM-NEXT: store i32 [[TMP6]], i32* [[TMP2]], align 4
|
||||
; IS________NPM-NEXT: [[TMP7:%.*]] = icmp sgt i32 [[TMP6]], 0
|
||||
; IS________NPM-NEXT: br i1 [[TMP7]], label [[TMP8:%.*]], label [[TMP10:%.*]]
|
||||
; IS________NPM: 8:
|
||||
; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1
|
||||
; IS________NPM-NEXT: [[TMP9:%.*]] = bitcast i8* [[DOTH2S]] to i32*
|
||||
; IS________NPM-NEXT: br label [[TMP4]]
|
||||
; IS________NPM: 10:
|
||||
; IS________NPM-NEXT: ret i32 5
|
||||
; CHECK-LABEL: define {{[^@]+}}@malloc_in_loop
|
||||
; CHECK-SAME: (i32 [[TMP0:%.*]]) {
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = alloca i32, align 4
|
||||
; CHECK-NEXT: [[TMP3:%.*]] = alloca i32*, align 8
|
||||
; CHECK-NEXT: store i32 [[TMP0]], i32* [[TMP2]], align 4
|
||||
; CHECK-NEXT: br label [[TMP4:%.*]]
|
||||
; CHECK: 4:
|
||||
; CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP2]], align 4
|
||||
; CHECK-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP5]], -1
|
||||
; CHECK-NEXT: store i32 [[TMP6]], i32* [[TMP2]], align 4
|
||||
; CHECK-NEXT: [[TMP7:%.*]] = icmp sgt i32 [[TMP6]], 0
|
||||
; CHECK-NEXT: br i1 [[TMP7]], label [[TMP8:%.*]], label [[TMP10:%.*]]
|
||||
; CHECK: 8:
|
||||
; CHECK-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1
|
||||
; CHECK-NEXT: [[TMP9:%.*]] = bitcast i8* [[DOTH2S]] to i32*
|
||||
; CHECK-NEXT: br label [[TMP4]]
|
||||
; CHECK: 10:
|
||||
; CHECK-NEXT: ret i32 5
|
||||
;
|
||||
%2 = alloca i32, align 4
|
||||
%3 = alloca i32*, align 8
|
||||
|
@ -820,7 +795,7 @@ define void @test16c(i8 %v, i8** %P) {
|
|||
; 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
|
||||
;
|
||||
|
@ -828,7 +803,7 @@ define void @test16c(i8 %v, i8** %P) {
|
|||
; 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)
|
||||
|
@ -850,18 +825,26 @@ define void @test16d(i8 %v, i8** %P) {
|
|||
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 nocallback 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 nocallback nofree nounwind willreturn writeonly }
|
||||
; IS________NPM: attributes #[[ATTR10]] = { nounwind }
|
||||
;.
|
||||
|
|
|
@ -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 @@ define i64 @f(i64 %len) {
|
|||
; IS________NPM-SAME: (i64 [[LEN:%.*]]) {
|
||||
; IS________NPM-NEXT: entry:
|
||||
; IS________NPM-NEXT: [[MEM_H2S:%.*]] = alloca i8, i64 [[LEN]], align 1
|
||||
; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM_H2S]]) #[[ATTR2:[0-9]+]]
|
||||
; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM_H2S]]) #[[ATTR5:[0-9]+]]
|
||||
; IS________NPM-NEXT: ret i64 [[RES]]
|
||||
;
|
||||
entry:
|
||||
|
@ -39,7 +39,7 @@ define i64 @g(i64 %len) {
|
|||
; 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 @@ define i64 @g(i64 %len) {
|
|||
; IS________NPM-NEXT: [[TMP0:%.*]] = mul i64 [[LEN]], 8
|
||||
; IS________NPM-NEXT: [[MEM_H2S:%.*]] = alloca i8, i64 [[TMP0]], align 1
|
||||
; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[MEM_H2S]], i8 0, i64 [[TMP0]], i1 false)
|
||||
; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM_H2S]]) #[[ATTR2]]
|
||||
; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM_H2S]]) #[[ATTR5]]
|
||||
; IS________NPM-NEXT: ret i64 [[RES]]
|
||||
;
|
||||
entry:
|
||||
|
@ -62,9 +62,15 @@ entry:
|
|||
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 nocallback 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 nocallback nofree nounwind willreturn writeonly }
|
||||
; IS________NPM: attributes #[[ATTR5]] = { nounwind }
|
||||
;.
|
||||
|
|
|
@ -74,8 +74,8 @@ declare i1 @llvm.coro.alloc(token)
|
|||
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}
|
||||
|
|
|
@ -76,6 +76,6 @@ declare i1 @llvm.coro.alloc(token)
|
|||
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")
|
||||
|
|
|
@ -413,8 +413,8 @@ lpad:
|
|||
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()
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ entry:
|
|||
}
|
||||
|
||||
; 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 }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -367,9 +367,9 @@ cleanup: ; preds = %entry, %if.end5, %i
|
|||
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") }
|
||||
|
|
|
@ -42,7 +42,7 @@ define void @test3() {
|
|||
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
|
||||
|
|
|
@ -264,9 +264,9 @@ define i32 addrspace(1)* @test13_addrspacecast() {
|
|||
}
|
||||
|
||||
|
||||
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 @@ entry:
|
|||
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.
|
||||
|
|
|
@ -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 @@ bb4:
|
|||
; CHECK_NO_LIBCALLS: ret i32 %
|
||||
}
|
||||
|
||||
declare noalias i8* @calloc(i64, i64)
|
||||
declare noalias i8* @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1)
|
||||
|
|
|
@ -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 @@ if.end: ; preds = %if.then, %entry
|
|||
; 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:
|
||||
|
|
|
@ -35,7 +35,7 @@ entry:
|
|||
|
||||
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)
|
||||
|
||||
|
|
|
@ -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*)
|
||||
|
||||
|
|
|
@ -23,4 +23,4 @@ define void @test() nounwind ssp {
|
|||
ret void
|
||||
}
|
||||
|
||||
declare noalias i8* @malloc(i64)
|
||||
declare noalias i8* @malloc(i64) allockind("alloc,uninitialized")
|
||||
|
|
|
@ -40,5 +40,5 @@ entry:
|
|||
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()
|
||||
|
|
|
@ -45,5 +45,5 @@ entry:
|
|||
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()
|
||||
|
|
|
@ -16,7 +16,7 @@ define void @init() {
|
|||
ret void
|
||||
}
|
||||
|
||||
declare noalias i8* @malloc(i64)
|
||||
declare noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0)
|
||||
|
||||
define i32 @get() {
|
||||
; CHECK-LABEL: @get(
|
||||
|
|
|
@ -17,7 +17,7 @@ define void @t() {
|
|||
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(
|
||||
|
|
|
@ -58,4 +58,4 @@ define dso_local i32 @main() {
|
|||
ret i32 %1
|
||||
}
|
||||
|
||||
declare dso_local noalias i8* @malloc(i64)
|
||||
declare dso_local noalias i8* @malloc(i64) allockind("alloc,uninitialized") allocsize(0)
|
||||
|
|
|
@ -44,5 +44,5 @@ entry:
|
|||
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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -42,6 +42,6 @@ define internal void @_ZL13PutsSomethingv() {
|
|||
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)
|
||||
|
|
|
@ -17,8 +17,8 @@ declare dso_local void @free(i8* nocapture noundef) local_unnamed_addr #2
|
|||
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 }
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -192,12 +192,12 @@ entry:
|
|||
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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -552,7 +552,7 @@ define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) {
|
|||
; 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 @@ define i8* @D98588(i8* %c1, i64 %offset) {
|
|||
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(
|
||||
|
|
|
@ -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 @@ define void @test_alloca() {
|
|||
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" }
|
||||
|
|
|
@ -26,10 +26,10 @@ define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
|
|||
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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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*)
|
||||
|
|
|
@ -192,7 +192,7 @@ entry:
|
|||
|
||||
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 @@ define i32 @test7(i8** %esc) {
|
|||
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(
|
||||
|
|
|
@ -6,14 +6,15 @@ define dso_local void @_Z3fooPv(i8* nocapture %0) local_unnamed_addr #0 {
|
|||
; 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 }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -139,7 +139,7 @@ define i64 @vla_pointer_size_mismatch(i42 %x) {
|
|||
ret i64 %objsize
|
||||
}
|
||||
|
||||
declare i8* @malloc(i64)
|
||||
declare i8* @malloc(i64) allocsize(0)
|
||||
|
||||
define i64 @test_objectsize_malloc() {
|
||||
; CHECK-LABEL: @test_objectsize_malloc(
|
||||
|
|
|
@ -328,7 +328,7 @@ define void @test8() {
|
|||
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] }
|
||||
|
|
Loading…
Reference in New Issue