Alexandre Isoard | 405728f | 2017-09-01 14:59:59 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s |
| 2 | |
| 3 | define void @foo([7 x i8]* %a) { |
| 4 | ; CHECK-LABEL: @foo |
| 5 | entry: |
| 6 | br label %bb |
| 7 | |
| 8 | bb: |
| 9 | %idx = phi i64 [ 0, %entry ], [ %idx.incr, %bb ] |
| 10 | %i = udiv i64 %idx, 7 |
| 11 | %j = urem i64 %idx, 7 |
| 12 | %a.ptr = getelementptr [7 x i8], [7 x i8]* %a, i64 %i, i64 %j |
| 13 | ; CHECK: %a.ptr = getelementptr [7 x i8], [7 x i8]* %a, i64 %i, i64 %j |
| 14 | ; CHECK-NEXT: --> {%a,+,1}<nw><%bb> |
| 15 | %val = load i8, i8* %a.ptr |
| 16 | %idx.incr = add i64 %idx, 1 |
| 17 | %test = icmp ne i64 %idx.incr, 35 |
| 18 | br i1 %test, label %bb, label %exit |
| 19 | |
| 20 | exit: |
| 21 | ret void |
| 22 | } |