1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=loop-deletion -S < %s | FileCheck %s
4 @a = global i1 false, align 4
9 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
11 ; CHECK-NEXT: [[D_015:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ]
12 ; CHECK-NEXT: call void @foo()
13 ; CHECK-NEXT: [[DOTB:%.*]] = load i1, ptr @a, align 4
14 ; CHECK-NEXT: [[CONV1:%.*]] = select i1 [[DOTB]], i32 -128, i32 1
15 ; CHECK-NEXT: [[CMP2_NOT:%.*]] = icmp ugt i32 [[CONV1]], [[D_015]]
16 ; CHECK-NEXT: br i1 [[CMP2_NOT]], label [[CLEANUP:%.*]], label [[FOR_INC8:%.*]]
18 ; CHECK-NEXT: [[INC9:%.*]] = add nuw nsw i32 [[D_015]], 1
19 ; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC9]], 19
20 ; CHECK-NEXT: br label [[CLEANUP]]
22 ; CHECK-NEXT: store i1 true, ptr @a, align 4
23 ; CHECK-NEXT: ret i32 0
29 %d.015 = phi i32 [ 0, %entry ], [ %inc9, %for.inc8 ]
31 %.b = load i1, ptr @a, align 4
32 %conv1 = select i1 %.b, i32 -128, i32 1
33 %cmp2.not = icmp ugt i32 %conv1, %d.015
34 br i1 %cmp2.not, label %cleanup, label %for.inc8
37 %inc9 = add nuw nsw i32 %d.015, 1
38 %exitcond.not = icmp eq i32 %inc9, 19
39 br i1 %exitcond.not, label %cleanup, label %for.body
42 store i1 true, ptr @a, align 4