1; RUN: opt < %s -mem2reg -disable-output
2; PR670
3
4define void @printk(i32, ...) {
5entry:
6	%flags = alloca i32		; <i32*> [#uses=2]
7	br i1 false, label %then.0, label %endif.0
8then.0:		; preds = %entry
9	br label %endif.0
10endif.0:		; preds = %then.0, %entry
11	store i32 0, i32* %flags
12	br label %loopentry
13loopentry:		; preds = %endif.3, %endif.0
14	br i1 false, label %no_exit, label %loopexit
15no_exit:		; preds = %loopentry
16	br i1 false, label %then.1, label %endif.1
17then.1:		; preds = %no_exit
18	br i1 false, label %shortcirc_done.0, label %shortcirc_next.0
19shortcirc_next.0:		; preds = %then.1
20	br label %shortcirc_done.0
21shortcirc_done.0:		; preds = %shortcirc_next.0, %then.1
22	br i1 false, label %shortcirc_done.1, label %shortcirc_next.1
23shortcirc_next.1:		; preds = %shortcirc_done.0
24	br label %shortcirc_done.1
25shortcirc_done.1:		; preds = %shortcirc_next.1, %shortcirc_done.0
26	br i1 false, label %shortcirc_done.2, label %shortcirc_next.2
27shortcirc_next.2:		; preds = %shortcirc_done.1
28	br label %shortcirc_done.2
29shortcirc_done.2:		; preds = %shortcirc_next.2, %shortcirc_done.1
30	br i1 false, label %then.2, label %endif.2
31then.2:		; preds = %shortcirc_done.2
32	br label %endif.2
33endif.2:		; preds = %then.2, %shortcirc_done.2
34	br label %endif.1
35endif.1:		; preds = %endif.2, %no_exit
36	br i1 false, label %then.3, label %endif.3
37then.3:		; preds = %endif.1
38	br label %endif.3
39endif.3:		; preds = %then.3, %endif.1
40	br label %loopentry
41loopexit:		; preds = %loopentry
42	br label %endif.4
43then.4:		; No predecessors!
44	%tmp.61 = load i32* %flags		; <i32> [#uses=0]
45	br label %out
46dead_block_after_goto:		; No predecessors!
47	br label %endif.4
48endif.4:		; preds = %dead_block_after_goto, %loopexit
49	br i1 false, label %then.5, label %else
50then.5:		; preds = %endif.4
51	br label %endif.5
52else:		; preds = %endif.4
53	br label %endif.5
54endif.5:		; preds = %else, %then.5
55	br label %out
56out:		; preds = %endif.5, %then.4
57	br label %return
58after_ret:		; No predecessors!
59	br label %return
60return:		; preds = %after_ret, %out
61	ret void
62}
63