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
5 define dso_local void @entry(i1 %cond) #0 {
6 ; TUNIT-LABEL: define {{[^@]+}}@entry
7 ; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR0:[0-9]+]] {
9 ; TUNIT-NEXT: call void @foo(i1 [[COND]]) #[[ATTR1:[0-9]+]]
10 ; TUNIT-NEXT: call void @bar() #[[ATTR2:[0-9]+]]
11 ; TUNIT-NEXT: call void @qux() #[[ATTR1]]
12 ; TUNIT-NEXT: ret void
14 ; CGSCC-LABEL: define {{[^@]+}}@entry
15 ; CGSCC-SAME: (i1 noundef [[COND:%.*]]) #[[ATTR0:[0-9]+]] {
17 ; CGSCC-NEXT: call void @foo(i1 noundef [[COND]]) #[[ATTR1:[0-9]+]]
18 ; CGSCC-NEXT: call void @bar() #[[ATTR2:[0-9]+]]
19 ; CGSCC-NEXT: call void @qux() #[[ATTR1]]
20 ; CGSCC-NEXT: ret void
23 call void @foo(i1 %cond)
29 define internal void @foo(i1 %cond) #1 {
30 ; TUNIT-LABEL: define {{[^@]+}}@foo
31 ; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
33 ; TUNIT-NEXT: call void @baz(i1 [[COND]]) #[[ATTR1]]
34 ; TUNIT-NEXT: ret void
36 ; CGSCC-LABEL: define {{[^@]+}}@foo
37 ; CGSCC-SAME: (i1 noundef [[COND:%.*]]) #[[ATTR1]] {
39 ; CGSCC-NEXT: call void @baz(i1 noundef [[COND]]) #[[ATTR1]]
40 ; CGSCC-NEXT: ret void
43 call void @baz(i1 %cond)
47 define internal void @bar() #2 {
48 ; CHECK-LABEL: define {{[^@]+}}@bar
49 ; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
51 ; CHECK-NEXT: call void @baz(i1 noundef false) #[[ATTR2]]
52 ; CHECK-NEXT: ret void
59 define internal void @baz(i1 %Cond) {
60 ; TUNIT-LABEL: define {{[^@]+}}@baz
61 ; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
63 ; TUNIT-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
65 ; TUNIT-NEXT: call void @baz(i1 noundef false) #[[ATTR1]]
66 ; TUNIT-NEXT: br label [[IF_END]]
68 ; TUNIT-NEXT: call void @qux() #[[ATTR1]]
69 ; TUNIT-NEXT: ret void
71 ; CGSCC-LABEL: define {{[^@]+}}@baz
72 ; CGSCC-SAME: (i1 noundef [[COND:%.*]]) #[[ATTR3:[0-9]+]] {
74 ; CGSCC-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
76 ; CGSCC-NEXT: call void @baz(i1 noundef false) #[[ATTR3]]
77 ; CGSCC-NEXT: br label [[IF_END]]
79 ; CGSCC-NEXT: call void @qux() #[[ATTR3]]
80 ; CGSCC-NEXT: ret void
83 %tobool = icmp ne i1 %Cond, 0
84 br i1 %tobool, label %if.then, label %if.end
95 define internal void @qux() {
96 ; TUNIT-LABEL: define {{[^@]+}}@qux
97 ; TUNIT-SAME: () #[[ATTR1]] {
99 ; TUNIT-NEXT: call void @call() #[[ATTR2]]
100 ; TUNIT-NEXT: ret void
102 ; CGSCC-LABEL: define {{[^@]+}}@qux() {
104 ; CGSCC-NEXT: call void @call() #[[ATTR2]]
105 ; CGSCC-NEXT: ret void
112 declare void @call() #3
114 attributes #0 = { "llvm.assume"="A" }
115 attributes #1 = { "llvm.assume"="B" }
116 attributes #2 = { "llvm.assume"="B,C" }
117 attributes #3 = { "llvm.assume"="B,C,A" }
119 ; TUNIT: attributes #[[ATTR0]] = { "llvm.assume"="A" }
120 ; TUNIT: attributes #[[ATTR1]] = { "llvm.assume"="A,B" }
121 ; TUNIT: attributes #[[ATTR2]] = { "llvm.assume"="A,B,C" }
122 ; TUNIT: attributes #[[ATTR3:[0-9]+]] = { "llvm.assume"="B,C,A" }
124 ; CGSCC: attributes #[[ATTR0]] = { "llvm.assume"="A" }
125 ; CGSCC: attributes #[[ATTR1]] = { "llvm.assume"="A,B" }
126 ; CGSCC: attributes #[[ATTR2]] = { "llvm.assume"="A,B,C" }
127 ; CGSCC: attributes #[[ATTR3]] = { "llvm.assume"="B" }
128 ; CGSCC: attributes #[[ATTR4:[0-9]+]] = { "llvm.assume"="B,C,A" }