1; RUN: opt < %s -indvars -S | FileCheck %s
2; PR11350: Check that SimplifyIndvar handles a cycle of useless self-phis.
3
4; CHECK-LABEL: @test(
5; CHECK-NOT: lcssa = phi
6define void @test() nounwind {
7entry:
8  br label %for.cond.preheader
9
10for.cond.preheader:                               ; preds = %entry
11  br label %for.cond.outer
12
13for.cond.outer:                                   ; preds = %for.cond.preheader, %for.end
14  %p_41.addr.0.ph = phi i32 [ %p_41.addr.1.lcssa, %for.end ], [ 1, %for.cond.preheader ]
15  br label %for.cond
16
17for.cond:
18  br i1 true, label %for.end, label %for.ph
19
20for.ph:                                   ; preds = %for.cond4.preheader
21  br label %for.end
22
23for.end:
24  %p_41.addr.1.lcssa = phi i32 [ undef, %for.ph ], [ %p_41.addr.0.ph, %for.cond ]
25  %p_68.lobit.i = lshr i32 %p_41.addr.1.lcssa, 31
26  %cmp7 = icmp eq i32 %p_41.addr.1.lcssa, 0
27  %conv8 = zext i1 %cmp7 to i32
28  br label %for.cond.outer
29}
30