Sanjoy Das | 91b5477 | 2015-03-09 21:43:43 +0000 | [diff] [blame^] | 1 | ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s |
| 2 | |
| 3 | define void @x(i1* %cond) { |
| 4 | ; CHECK-LABEL: Classifying expressions for: @x |
| 5 | entry: |
| 6 | br label %loop |
| 7 | |
| 8 | loop: |
| 9 | %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ] |
| 10 | ; CHECK: %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ] |
| 11 | ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-128) S: [0,-128) |
| 12 | |
| 13 | %idx.inc = add nsw i8 %idx, 1 |
| 14 | |
| 15 | %c = load volatile i1, i1* %cond |
| 16 | br i1 %c, label %loop, label %exit |
| 17 | |
| 18 | exit: |
| 19 | ret void |
| 20 | } |
| 21 | |
| 22 | define void @y(i8* %addr) { |
| 23 | ; CHECK-LABEL: Classifying expressions for: @y |
| 24 | entry: |
| 25 | br label %loop |
| 26 | |
| 27 | loop: |
| 28 | %idx = phi i8 [-5, %entry ], [ %idx.inc, %loop ] |
| 29 | ; CHECK: %idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ] |
| 30 | ; CHECK-NEXT: --> {-5,+,1}<%loop> U: [-5,6) S: [-5,6) |
| 31 | |
| 32 | %idx.inc = add i8 %idx, 1 |
| 33 | |
| 34 | %continue = icmp slt i8 %idx.inc, 6 |
| 35 | br i1 %continue, label %loop, label %exit |
| 36 | |
| 37 | exit: |
| 38 | ret void |
| 39 | } |