1; RUN: opt < %s -loop-unswitch -enable-new-pm=0 -disable-output
2; RUN: opt < %s -loop-unswitch -enable-new-pm=0 -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
3
4define void @test1(i32* %S2) {
5entry:
6	br i1 false, label %list_Length.exit, label %cond_true.i
7cond_true.i:		; preds = %entry
8	ret void
9list_Length.exit:		; preds = %entry
10	br i1 false, label %list_Length.exit9, label %cond_true.i5
11cond_true.i5:		; preds = %list_Length.exit
12	ret void
13list_Length.exit9:		; preds = %list_Length.exit
14	br i1 false, label %bb78, label %return
15bb44:		; preds = %bb78, %cond_next68
16	br i1 %tmp49.not, label %bb62, label %bb62.loopexit
17bb62.loopexit:		; preds = %bb44
18	br label %bb62
19bb62:		; preds = %bb62.loopexit, %bb44
20	br i1 false, label %return.loopexit, label %cond_next68
21cond_next68:		; preds = %bb62
22	br i1 false, label %return.loopexit, label %bb44
23bb78:		; preds = %list_Length.exit9
24	%tmp49.not = icmp eq i32* %S2, null		; <i1> [#uses=1]
25	br label %bb44
26return.loopexit:		; preds = %cond_next68, %bb62
27	%retval.0.ph = phi i32 [ 1, %cond_next68 ], [ 0, %bb62 ]		; <i32> [#uses=1]
28	br label %return
29return:		; preds = %return.loopexit, %list_Length.exit9
30	%retval.0 = phi i32 [ 0, %list_Length.exit9 ], [ %retval.0.ph, %return.loopexit ]		; <i32> [#uses=0]
31	ret void
32}
33
34define void @test2() nounwind {
35entry:
36  br label %bb.nph
37
38bb.nph:                                           ; preds = %entry
39  %and.i13521 = and <4 x i1> undef, undef         ; <<4 x i1>> [#uses=1]
40  br label %for.body
41
42for.body:                                         ; preds = %for.body, %bb.nph
43  %or.i = select <4 x i1> %and.i13521, <4 x i32> undef, <4 x i32> undef ; <<4 x i32>> [#uses=0]
44  br i1 false, label %for.body, label %for.end
45
46for.end:                                          ; preds = %for.body, %entry
47  ret void
48}
49
50; PR6879
51define i32* @test3(i32** %p_45, i16 zeroext %p_46, i64 %p_47, i64 %p_48, i16 signext %p_49) nounwind {
52entry:
53  br label %for.cond
54
55for.cond:                                         ; preds = %for.cond4, %entry
56  br i1 false, label %for.cond4, label %for.end88
57
58for.cond4:                                        ; preds = %for.cond
59  %conv46 = trunc i32 0 to i8                     ; <i8> [#uses=2]
60  %cmp60 = icmp sgt i8 %conv46, 124               ; <i1> [#uses=1]
61  %or.cond = and i1 undef, %cmp60                 ; <i1> [#uses=1]
62  %cond = select i1 %or.cond, i8 %conv46, i8 undef ; <i8> [#uses=0]
63  br label %for.cond
64
65for.end88:                                        ; preds = %for.cond
66  ret i32* undef
67}
68