1 ; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution < %s | FileCheck %s
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
4 define void @x(i1* %cond) {
5 ; CHECK-LABEL: Classifying expressions for: @x
10 %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
11 ; CHECK: %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
12 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-128) S: [0,-128)
14 %idx.inc = add nsw i8 %idx, 1
16 %c = load volatile i1, i1* %cond
17 br i1 %c, label %loop, label %exit
23 define void @y(i8* %addr) {
24 ; CHECK-LABEL: Classifying expressions for: @y
29 %idx = phi i8 [-5, %entry ], [ %idx.inc, %loop ]
30 ; CHECK: %idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ]
31 ; CHECK-NEXT: --> {-5,+,1}<%loop> U: [-5,6) S: [-5,6)
33 %idx.inc = add i8 %idx, 1
35 %continue = icmp slt i8 %idx.inc, 6
36 br i1 %continue, label %loop, label %exit