1; RUN: opt -indvars -S < %s | FileCheck %s 2 3declare void @use(i1) 4 5declare void @llvm.experimental.guard(i1, ...) 6 7define void @test_01(i8 %t) { 8; CHECK-LABEL: test_01 9 entry: 10 %st = sext i8 %t to i16 11 %cmp1 = icmp slt i16 %st, 42 12 call void(i1, ...) @llvm.experimental.guard(i1 %cmp1) [ "deopt"() ] 13 br label %loop 14 15 loop: 16; CHECK-LABEL: loop 17 %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ] 18 %idx.inc = add i8 %idx, 1 19 %c = icmp slt i8 %idx, 42 20; CHECK: call void @use(i1 true) 21 call void @use(i1 %c) 22 %be = icmp slt i8 %idx.inc, 42 23 br i1 %be, label %loop, label %exit 24 25 exit: 26 ret void 27} 28 29define void @test_02(i8 %t) { 30; CHECK-LABEL: test_02 31 entry: 32 %t.ptr = inttoptr i8 %t to i8* 33 %p.42 = inttoptr i8 42 to i8* 34 %cmp1 = icmp slt i8* %t.ptr, %p.42 35 call void(i1, ...) @llvm.experimental.guard(i1 %cmp1) [ "deopt"() ] 36 br label %loop 37 38 loop: 39; CHECK-LABEL: loop 40 %idx = phi i8* [ %t.ptr, %entry ], [ %snext, %loop ] 41 %snext = getelementptr inbounds i8, i8* %idx, i64 1 42 %c = icmp slt i8* %idx, %p.42 43; CHECK: call void @use(i1 true) 44 call void @use(i1 %c) 45 %be = icmp slt i8* %snext, %p.42 46 br i1 %be, label %loop, label %exit 47 48 exit: 49 ret void 50} 51