xref: /llvm-project/llvm/test/Transforms/Attributor/nodelete.ll (revision 754b93e4668fbe02a2e36e6c3e1afa52c5a53327)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
4
5%"a" = type { i64 }
6%"b" = type { i8 }
7
8define hidden i64 @f1() align 2 {
9; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
10; TUNIT-LABEL: define {{[^@]+}}@f1
11; TUNIT-SAME: () #[[ATTR0:[0-9]+]] align 2 {
12; TUNIT-NEXT:  entry:
13; TUNIT-NEXT:    [[REF_TMP1:%.*]] = alloca i8, i32 0, align 8
14; TUNIT-NEXT:    ret i64 undef
15;
16; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
17; CGSCC-LABEL: define {{[^@]+}}@f1
18; CGSCC-SAME: () #[[ATTR0:[0-9]+]] align 2 {
19; CGSCC-NEXT:  entry:
20; CGSCC-NEXT:    [[REF_TMP:%.*]] = alloca [[A:%.*]], align 8
21; CGSCC-NEXT:    [[REF_TMP1:%.*]] = alloca i8, i32 0, align 8
22; CGSCC-NEXT:    [[CALL2:%.*]] = call i64 @f2() #[[ATTR2:[0-9]+]]
23; CGSCC-NEXT:    ret i64 [[CALL2]]
24;
25entry:
26  %ref.tmp = alloca %"a", align 8
27  %call2 = call i64 @f2(ptr %ref.tmp)
28  ret i64 %call2
29}
30
31define internal i64 @f2(ptr %this) align 2 {
32; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
33; CGSCC-LABEL: define {{[^@]+}}@f2
34; CGSCC-SAME: () #[[ATTR0]] align 2 {
35; CGSCC-NEXT:  entry:
36; CGSCC-NEXT:    ret i64 undef
37;
38entry:
39  %this.addr = alloca ptr, align 8
40  store ptr %this, ptr %this.addr, align 8
41  %this1 = load ptr, ptr %this.addr, align 8
42  call void @f3(ptr %this1)
43  ret i64 undef
44}
45
46define internal void @f3(ptr %this) align 2 {
47; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
48; CGSCC-LABEL: define {{[^@]+}}@f3
49; CGSCC-SAME: () #[[ATTR0]] align 2 {
50; CGSCC-NEXT:  entry:
51; CGSCC-NEXT:    ret void
52;
53entry:
54  %this.addr = alloca ptr, align 8
55  store ptr %this, ptr %this.addr, align 8
56  %this1 = load ptr, ptr %this.addr, align 8
57  %call = call i1 @f4(ptr %this1)
58  ret void
59}
60
61define internal i1 @f4(ptr %this) align 2 {
62; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
63; CGSCC-LABEL: define {{[^@]+}}@f4
64; CGSCC-SAME: () #[[ATTR0]] align 2 {
65; CGSCC-NEXT:  entry:
66; CGSCC-NEXT:    ret i1 undef
67;
68entry:
69  %this.addr = alloca ptr, align 8
70  store ptr %this, ptr %this.addr, align 8
71  %this1 = load ptr, ptr %this.addr, align 8
72  %call = call ptr @f5(ptr %this1)
73  ret i1 undef
74}
75
76define internal ptr @f5(ptr %this) align 2 {
77; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
78; CGSCC-LABEL: define {{[^@]+}}@f5
79; CGSCC-SAME: () #[[ATTR1:[0-9]+]] align 2 {
80; CGSCC-NEXT:  entry:
81; CGSCC-NEXT:    ret ptr undef
82;
83entry:
84  %this.addr = alloca ptr, align 8
85  store ptr %this, ptr %this.addr, align 8
86  %this1 = load ptr, ptr %this.addr, align 8
87  ret ptr %this1
88}
89;.
90; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
91;.
92; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
93; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
94; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }
95;.
96;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
97; CHECK: {{.*}}
98