1 ; RUN: opt -indvars -S < %s | FileCheck %s
3 define void @infer_via_ranges(i32 *%arr, i32 %n) {
4 ; CHECK-LABEL: @infer_via_ranges
6 %first.itr.check = icmp sgt i32 %n, 0
8 br i1 %first.itr.check, label %loop, label %exit
12 %idx = phi i32 [ %start, %entry ] , [ %idx.dec, %in.bounds ]
13 %idx.dec = sub i32 %idx, 1
14 %abc = icmp sge i32 %idx, 0
15 ; CHECK: br i1 true, label %in.bounds, label %out.of.bounds
16 br i1 %abc, label %in.bounds, label %out.of.bounds
19 ; CHECK-LABEL: in.bounds:
20 %addr = getelementptr i32, i32* %arr, i32 %idx
21 store i32 0, i32* %addr
22 %next = icmp sgt i32 %idx.dec, -1
23 br i1 %next, label %loop, label %exit