1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes='loop(indvars,loop-unroll-full)' -S %s | FileCheck %s
4 ; FIXME: The function is mis-compiled at the moment,
5 ; store i64 [[SEL_2_LCSSA]], ptr [[DST_2:%.*]] writes the wrong value.
6 define i8 @test_pr58340(ptr %dst.1, ptr %dst.2) {
7 ; CHECK-LABEL: @test_pr58340(
9 ; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
10 ; CHECK: outer.header:
11 ; CHECK-NEXT: br label [[INNER_1_HEADER:%.*]]
12 ; CHECK: inner.1.header:
13 ; CHECK-NEXT: br i1 true, label [[MERGE:%.*]], label [[THEN:%.*]]
15 ; CHECK-NEXT: br label [[MERGE]]
17 ; CHECK-NEXT: [[SEL_1:%.*]] = phi i32 [ 0, [[INNER_1_HEADER]] ], [ 2, [[THEN]] ]
18 ; CHECK-NEXT: store i32 [[SEL_1]], ptr [[DST_1:%.*]], align 4
19 ; CHECK-NEXT: br label [[INNER_1_LATCH:%.*]]
20 ; CHECK: inner.2.header.preheader:
21 ; CHECK-NEXT: br label [[INNER_2_HEADER:%.*]]
22 ; CHECK: inner.1.latch:
23 ; CHECK-NEXT: br i1 false, label [[MERGE_1:%.*]], label [[THEN_1:%.*]]
25 ; CHECK-NEXT: br label [[MERGE_1]]
27 ; CHECK-NEXT: [[SEL_1_1:%.*]] = phi i32 [ 0, [[INNER_1_LATCH]] ], [ 2, [[THEN_1]] ]
28 ; CHECK-NEXT: store i32 [[SEL_1_1]], ptr [[DST_1]], align 4
29 ; CHECK-NEXT: br i1 false, label [[INNER_1_LATCH_1:%.*]], label [[INNER_2_HEADER_PREHEADER:%.*]]
30 ; CHECK: inner.1.latch.1:
31 ; CHECK-NEXT: unreachable
32 ; CHECK: inner.2.header:
33 ; CHECK-NEXT: br label [[INNER_3:%.*]]
35 ; CHECK-NEXT: store i32 0, ptr [[DST_1]], align 4
36 ; CHECK-NEXT: store i64 0, ptr [[DST_2:%.*]], align 8
37 ; CHECK-NEXT: call void @clobber()
38 ; CHECK-NEXT: br label [[OUTER_HEADER]]
41 br label %outer.header
44 %p.1 = phi i64 [ 0, %entry ], [ %sel.2, %outer.latch ]
45 br label %inner.1.header
48 %p.2 = phi i64 [ %p.1, %outer.header ], [ 0, %inner.1.latch ]
49 %b = phi i1 [ true, %outer.header ], [ false, %inner.1.latch ]
50 br i1 %b, label %merge, label %then
56 %sel.1 = phi i32 [ 0, %inner.1.header ], [ 2, %then ]
57 store i32 %sel.1, ptr %dst.1, align 4
58 br i1 %b, label %inner.1.latch, label %inner.2.header
61 br label %inner.1.header
67 %sel.2 = phi i64 [ %sel.1.ext, %inner.3 ], [ 0, %inner.2.header ]
68 %c.1 = icmp ult i32 %sel.1, 1
69 %sel.1.ext = sext i32 %sel.1 to i64
70 br i1 %c.1, label %inner.3, label %inner.2.latch
73 br i1 false, label %inner.2.header, label %outer.latch
76 store i32 0, ptr %dst.1, align 4
77 store i64 %sel.2, ptr %dst.2, align 8
79 br label %outer.header
82 declare void @clobber()