1; RUN: opt -S -jump-threading < %s | FileCheck %s 2 3define i8 @test(i32 %a, i32 %length) { 4; CHECK-LABEL: @test 5entry: 6; CHECK: br label %backedge 7 br label %loop 8 9loop: 10; CHECK-LABEL: backedge: 11; CHECK: phi i32 12; CHECK: br i1 %cont, label %backedge, label %exit 13 %iv = phi i32 [0, %entry], [%iv.next, %backedge] 14 ;; We can use an inductive argument to prove %iv is always positive 15 %cnd = icmp sge i32 %iv, 0 16 br i1 %cnd, label %backedge, label %exit 17 18backedge: 19 %iv.next = add nsw i32 %iv, 1 20 %cont = icmp slt i32 %iv.next, 400 21 br i1 %cont, label %loop, label %exit 22exit: 23 ret i8 0 24} 25 26