1; RUN: opt -S -indvars < %s | FileCheck %s
2
3define i16 @fn1() {
4; CHECK-LABEL: @fn1(
5entry:
6  br label %bb1
7
8bb1:
9  %i = phi i16 [ 0, %entry ], [ 1, %bb1 ]
10  %storemerge = phi i16 [ %storemerge2, %bb1 ], [ 0, %entry ]
11  %storemerge2 = phi i16 [ 10, %entry ], [ 200, %bb1 ]
12  %tmp10 = icmp eq i16 %i, 1
13  br i1 %tmp10, label %bb5, label %bb1
14
15bb5:
16  %storemerge.lcssa = phi i16 [ %storemerge, %bb1 ]
17; CHECK: ret i16 10
18  ret i16 %storemerge.lcssa
19}
20
21define i16 @fn2() {
22; CHECK-LABEL: @fn2(
23entry:
24  br label %bb1
25
26bb1:
27  %canary = phi i16 [ 0, %entry ], [ %canary.inc, %bb1 ]
28  %i = phi i16 [ 0, %entry ], [ %storemerge, %bb1 ]
29  %storemerge = phi i16 [ 0, %bb1 ], [ 10, %entry ]
30  %canary.inc = add i16 %canary, 1
31  %_tmp10 = icmp eq i16 %i, 10
32  br i1 %_tmp10, label %bb5, label %bb1
33
34bb5:
35; CHECK: ret i16 1
36  ret i16 %canary
37}
38