blob: b17bbde45e77ebcc4d050773e308905af45fc2c0 [file] [log] [blame]
Florian Hahn1f95ef12018-02-13 10:02:52 +00001; RUN: opt < %s -loop-interchange -S | FileCheck %s
2
3; BB latch1 is the loop latch, but does not exit the loop.
4define void @foo() {
5entry:
6 %dest = alloca i16*, align 8
7 br label %header1
8
9header1:
10 %0 = phi i16* [ %2, %latch1 ], [ undef, %entry ]
11 br i1 false, label %inner, label %loopexit
12
13inner:
14 br i1 undef, label %inner.ph, label %latch1
15
16inner.ph:
17 br label %inner.body
18
19inner.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
24inner.loopexit:
25 br label %latch1
26
27latch1:
28 %2 = phi i16* [ %0, %inner ], [ undef, %inner.loopexit ]
29 br label %header1
30
31loopexit: ; 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