1 ;; RUN: opt -S < %s -passes=indvars | FileCheck %s
3 ;; Check if IndVarSimplify understands !range metadata.
7 define i1 @iterate(ptr nocapture readonly %buffer) {
9 %length = load i32, ptr %buffer, !range !0
10 br label %loop.preheader
16 %idx = phi i32 [ %idx.inc, %loop.next ], [ 0, %loop.preheader ]
17 %oob.pred = icmp slt i32 %idx, %length
18 br i1 %oob.pred, label %loop.next, label %oob
19 ; CHECK: br i1 true, label %loop.next, label %oob
22 %idx.inc = add i32 %idx, 1
23 %exit.pred = icmp slt i32 %idx.inc, %length
24 br i1 %exit.pred, label %loop, label %abort.loopexit
33 tail call void @abort()
37 !0 = !{i32 1, i32 100}