| Florian Hahn | 1f95ef1 | 2018-02-13 10:02:52 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -loop-interchange -S | FileCheck %s |
| 2 | |
| 3 | ; BB latch1 is the loop latch, but does not exit the loop. |
| 4 | define void @foo() { |
| 5 | entry: |
| 6 | %dest = alloca i16*, align 8 |
| 7 | br label %header1 |
| 8 | |
| 9 | header1: |
| 10 | %0 = phi i16* [ %2, %latch1 ], [ undef, %entry ] |
| 11 | br i1 false, label %inner, label %loopexit |
| 12 | |
| 13 | inner: |
| 14 | br i1 undef, label %inner.ph, label %latch1 |
| 15 | |
| 16 | inner.ph: |
| 17 | br label %inner.body |
| 18 | |
| 19 | inner.body: |
| 20 | %1 = load i16, i16* %0, align 2 |
| 21 | store i16* inttoptr (i64 2 to i16*), i16** %dest, align 8 |
| 22 | br i1 false, label %inner.body, label %inner.loopexit |
| 23 | |
| 24 | inner.loopexit: |
| 25 | br label %latch1 |
| 26 | |
| 27 | latch1: |
| 28 | %2 = phi i16* [ %0, %inner ], [ undef, %inner.loopexit ] |
| 29 | br label %header1 |
| 30 | |
| 31 | loopexit: ; preds = %header1 |
| 32 | unreachable |
| 33 | } |
| 34 | |
| 35 | ; CHECK-LABEL: inner.body: |
| 36 | ; CHECK: br i1 false, label %inner.body, label %inner.loopexit |
| 37 | ; CHECK: latch1: |
| 38 | ; CHECK-NEXT: %2 = phi i16* [ %0, %inner ], [ undef, %inner.loopexit ] |
| 39 | ; CHECK-NEXT: br label %header1 |
| 40 | |