1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=indvars < %s | FileCheck %s
4 ; The comparison should not get folded to false.
6 ; CHECK-LABEL: define void @test() {
8 ; CHECK-NEXT: br label [[LOOP:%.*]]
10 ; CHECK-NEXT: [[IV:%.*]] = phi i8 [ 1, [[ENTRY:%.*]] ], [ [[IV_DEC:%.*]], [[LOOP]] ]
11 ; CHECK-NEXT: [[IV_DEC]] = add nsw i8 [[IV]], -1
12 ; CHECK-NEXT: [[SHL:%.*]] = shl i8 [[IV]], 7
13 ; CHECK-NEXT: call void @use(i8 [[SHL]])
14 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 [[SHL]], 0
15 ; CHECK-NEXT: br i1 [[CMP1]], label [[EXIT:%.*]], label [[LOOP]]
17 ; CHECK-NEXT: ret void
23 %iv = phi i8 [ 1, %entry ], [ %iv.dec, %loop ]
24 %iv.dec = add i8 %iv, -1
26 call void @use(i8 %shl)
27 %cmp1 = icmp eq i8 %shl, 0
28 br i1 %cmp1, label %exit, label %loop
34 declare void @use(i32)