1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes --check-globals
2 ; call site specific analysis is disabled
4 ; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
6 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
8 ; 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
10 ; 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
12 define dso_local i32 @test_range1(i32 %0) #0 {
13 ; CHECK-LABEL: define {{[^@]+}}@test_range1
14 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
15 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 0
16 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
18 ; CHECK-NEXT: br label [[TMP5:%.*]]
20 ; CHECK-NEXT: br label [[TMP5]]
22 ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 0, [[TMP4]] ]
23 ; CHECK-NEXT: ret i32 [[DOT0]]
25 %2 = icmp ne i32 %0, 0
26 br i1 %2, label %3, label %4
35 %.0 = phi i32 [ 100, %3 ], [ 0, %4 ]
39 define i32 @test_range2(i32 %0) #0 {
40 ; CHECK-LABEL: define {{[^@]+}}@test_range2
41 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
42 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 0
43 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
45 ; CHECK-NEXT: br label [[TMP5:%.*]]
47 ; CHECK-NEXT: br label [[TMP5]]
49 ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 200, [[TMP4]] ]
50 ; CHECK-NEXT: ret i32 [[DOT0]]
52 %2 = icmp ne i32 %0, 0
53 br i1 %2, label %3, label %4
62 %.0 = phi i32 [ 100, %3 ], [ 200, %4 ]
65 define i32 @test(i32 %0, i32 %1) #0 {
66 ; CHECK-LABEL: define {{[^@]+}}@test
67 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
68 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0
69 ; CHECK-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]
71 ; CHECK-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
72 ; CHECK-NEXT: br label [[TMP8:%.*]]
74 ; CHECK-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]]) #[[ATTR1]], !range [[RNG1:![0-9]+]]
75 ; CHECK-NEXT: br label [[TMP8]]
77 ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]
78 ; CHECK-NEXT: ret i32 [[DOT0]]
80 %3 = icmp ne i32 %1, 0
81 br i1 %3, label %4, label %6
84 %5 = call i32 @test_range1(i32 %0)
88 %7 = call i32 @test_range2(i32 %0)
92 %.0 = phi i32 [ %5, %4 ], [ %7, %6 ]
96 define i32 @test_pcheck1(i32 %0) #0 {
97 ; CHECK-LABEL: define {{[^@]+}}@test_pcheck1
98 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
99 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2:![0-9]+]]
100 ; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101
101 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
102 ; CHECK-NEXT: ret i32 [[TMP4]]
104 %2 = call i32 @test(i32 %0, i32 1)
105 %3 = icmp slt i32 %2, 101
106 %4 = zext i1 %3 to i32
110 define i32 @test_pcheck2(i32 %0) #0 {
111 ; CHECK-LABEL: define {{[^@]+}}@test_pcheck2
112 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
113 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
114 ; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99
115 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
116 ; CHECK-NEXT: ret i32 [[TMP4]]
118 %2 = call i32 @test(i32 %0, i32 0)
119 %3 = icmp sgt i32 %2, 99
120 %4 = zext i1 %3 to i32
124 define i32 @test_ncheck1(i32 %0) #0 {
125 ; CHECK-LABEL: define {{[^@]+}}@test_ncheck1
126 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
127 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2]]
128 ; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50
129 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
130 ; CHECK-NEXT: ret i32 [[TMP4]]
132 %2 = call i32 @test(i32 %0, i32 1)
133 %3 = icmp sgt i32 %2, 50
134 %4 = zext i1 %3 to i32
138 define i32 @test_ncheck2(i32 %0) #0 {
139 ; CHECK-LABEL: define {{[^@]+}}@test_ncheck2
140 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
141 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
142 ; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150
143 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
144 ; CHECK-NEXT: ret i32 [[TMP4]]
146 %2 = call i32 @test(i32 %0, i32 0)
147 %3 = icmp sgt i32 %2, 150
148 %4 = zext i1 %3 to i32
152 attributes #0 = { noinline nounwind sspstrong uwtable}
154 ; IS__TUNIT_____: !0 = !{i32 0, i32 101}
155 ; IS__TUNIT_____: !1 = !{i32 100, i32 201}
157 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noinline nosync nounwind readnone sspstrong uwtable willreturn }
158 ; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
160 ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong uwtable willreturn }
161 ; IS__CGSCC____: attributes #[[ATTR1]] = { readnone willreturn }
163 ; CHECK: [[RNG0]] = !{i32 0, i32 101}
164 ; CHECK: [[RNG1]] = !{i32 100, i32 201}
165 ; CHECK: [[RNG2]] = !{i32 0, i32 201}