1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
2 ; RUN: opt < %s -passes=loop-deletion -verify-dom-info -S | FileCheck %s
5 ;; void unknown_tripcount_mustprogress_attr_mustprogress_loopmd(int a, int b) {
10 define void @unknown_tripcount_mustprogress_attr_mustprogress_loopmd(i32 %a, i32 %b) #0 {
11 ; CHECK: Function Attrs: mustprogress
12 ; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_mustprogress_loopmd
13 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]] {
15 ; CHECK-NEXT: br label [[FOR_END:%.*]]
17 ; CHECK-NEXT: unreachable
22 %cmp = icmp slt i32 %a, %b
23 br i1 %cmp, label %for.body, label %for.end
25 br label %for.cond, !llvm.loop !2
33 ;; void unknown_tripcount_mustprogress_attr_no_mustprogress_loopmd(int a, int b) {
37 ;; => Removed mustprogress loop attribute
39 define void @unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd(i32 %a, i32 %b) #0 {
40 ; CHECK: Function Attrs: mustprogress
41 ; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd
42 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0]] {
44 ; CHECK-NEXT: br label [[FOR_END:%.*]]
46 ; CHECK-NEXT: unreachable
51 %cmp = icmp slt i32 %a, %b
52 br i1 %cmp, label %for.body, label %for.end
62 ;; void known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
63 ;; for (int i = 0; i < 5; i++) ;
66 define void @known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
67 ; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
69 ; CHECK-NEXT: br label [[FOR_END:%.*]]
71 ; CHECK-NEXT: ret void
76 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
77 %cmp = icmp slt i32 %i.0, 5
78 br i1 %cmp, label %for.body, label %for.end
82 %inc = add nsw i32 %i.0, 1
89 ;; void known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
90 ;; for (int i = 0; i < 5; i++) ;
92 ;; => Added mustprogress loop attribute
94 define void @known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
95 ; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
97 ; CHECK-NEXT: br label [[FOR_END:%.*]]
99 ; CHECK-NEXT: ret void
104 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
105 %cmp = icmp slt i32 %i.0, 5
106 br i1 %cmp, label %for.body, label %for.end
110 %inc = add nsw i32 %i.0, 1
111 br label %for.cond, !llvm.loop !4
117 ;; void known_tripcount_mustprogress_attr_no_mustprogress_loopmd() {
118 ;; for (int i = 0; i < 5; i++) ;
120 ;; => Added mustprogress function attribute
122 define void @known_tripcount_mustprogress_attr_no_mustprogress_loopmd() #0 {
123 ; CHECK: Function Attrs: mustprogress
124 ; CHECK-LABEL: define {{[^@]+}}@known_tripcount_mustprogress_attr_no_mustprogress_loopmd
125 ; CHECK-SAME: () [[ATTR0]] {
127 ; CHECK-NEXT: br label [[FOR_END:%.*]]
129 ; CHECK-NEXT: ret void
134 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
135 %cmp = icmp slt i32 %i.0, 5
136 br i1 %cmp, label %for.body, label %for.end
140 %inc = add nsw i32 %i.0, 1
147 ;; void known_tripcount_mustprogress_attr_mustprogress_loopmd() {
148 ;; for (int i = 0; i < 5; i++) ;
150 ;; => Added mustprogress function and mustprogress loop attribute
152 define void @known_tripcount_mustprogress_attr_mustprogress_loopmd() #0 {
153 ; CHECK: Function Attrs: mustprogress
154 ; CHECK-LABEL: define {{[^@]+}}@known_tripcount_mustprogress_attr_mustprogress_loopmd
155 ; CHECK-SAME: () [[ATTR0]] {
157 ; CHECK-NEXT: br label [[FOR_END:%.*]]
159 ; CHECK-NEXT: ret void
164 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
165 %cmp = icmp slt i32 %i.0, 5
166 br i1 %cmp, label %for.body, label %for.end
170 %inc = add nsw i32 %i.0, 1
171 br label %for.cond, !llvm.loop !5
177 ;; void unknown_tripcount_no_mustprogress_attr_mustprogress_loopmd(int a, int b) {
180 ;; => Added mustprogress loop attribute
182 define void @unknown_tripcount_no_mustprogress_attr_mustprogress_loopmd(i32 %a, i32 %b) {
183 ; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_no_mustprogress_attr_mustprogress_loopmd
184 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
186 ; CHECK-NEXT: br label [[FOR_END:%.*]]
188 ; CHECK-NEXT: ret void
193 %cmp = icmp slt i32 %a, %b
194 br i1 %cmp, label %for.body, label %for.end
196 br label %for.cond, !llvm.loop !6
202 ;; void unknown_tripcount_no_mustprogress_attr_no_mustprogress_loopmd(int a, int b) {
206 define void @unknown_tripcount_no_mustprogress_attr_no_mustprogress_loopmd(i32 %a, i32 %b) {
207 ; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_no_mustprogress_attr_no_mustprogress_loopmd
208 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
210 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
212 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[A]], [[B]]
213 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
215 ; CHECK-NEXT: br label [[FOR_COND]]
217 ; CHECK-NEXT: ret void
222 %cmp = icmp slt i32 %a, %b
223 br i1 %cmp, label %for.body, label %for.end
230 ; CHECK: attributes [[ATTR0]] = { mustprogress }
232 attributes #0 = { mustprogress }
233 !2 = distinct !{!2, !3}
234 !3 = !{!"llvm.loop.mustprogress"}
235 !4 = distinct !{!4, !3}
236 !5 = distinct !{!5, !3}
237 !6 = distinct !{!6, !3}