1; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4
2
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4
5%type1 = type { %type2 }
6%type2 = type { [0 x i8*], i8**, i32, i32, i32 }
7
8define void @test() nounwind uwtable align 2 {
9  br label %for.body.lr.ph.i.i.i
10
11for.body.lr.ph.i.i.i:
12  br label %for.body.i.i.i
13
14for.body.i.i.i:
15  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.i.i.i ], [ 0, %for.body.lr.ph.i.i.i ]
16  br label %for.inc.i.i.i
17
18for.inc.i.i.i:
19  %indvars.iv.next = add i64 %indvars.iv, 1
20  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
21  %exitcond = icmp ne i32 %lftr.wideiv, undef
22  br i1 %exitcond, label %for.body.i.i.i, label %for.end.i.i.i
23
24for.end.i.i.i:
25  %lcssa = phi %type1* [ undef, %for.inc.i.i.i ]
26  unreachable
27}
28
29; PR16139
30define void @test2(i8* %x) {
31entry:
32  indirectbr i8* %x, [ label %L0, label %L1 ]
33
34L0:
35  br label %L0
36
37L1:
38  ret void
39}
40
41; This loop has different uniform instructions before and after LCSSA.
42define void @test3() {
43entry:
44  %add41 = add i32 undef, undef
45  %idxprom4736 = zext i32 %add41 to i64
46  br label %while.body
47
48while.body:
49  %idxprom4738 = phi i64 [ %idxprom47, %while.body ], [ %idxprom4736, %entry ]
50  %pos.337 = phi i32 [ %inc46, %while.body ], [ %add41, %entry ]
51  %inc46 = add i32 %pos.337, 1
52  %arrayidx48 = getelementptr inbounds [1024 x i8], [1024 x i8]* undef, i64 0, i64 %idxprom4738
53  store i8 0, i8* %arrayidx48, align 1
54  %and43 = and i32 %inc46, 3
55  %cmp44 = icmp eq i32 %and43, 0
56  %idxprom47 = zext i32 %inc46 to i64
57  br i1 %cmp44, label %while.end, label %while.body
58
59while.end:
60  %add58 = add i32 %inc46, 4
61  ret void
62}
63