1; RUN: llc < %s > %t
2; PR6300
3target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
4target triple = "i386-pc-linux-gnu"
5
6; When the "154" loops back onto itself, it defines a register after using it.
7; The first value of the register is implicit-def.
8
9%"struct location_chain_def" = type { %"struct location_chain_def"*, %"struct rtx_def"*, %"struct rtx_def"*, i32 }
10%"struct real_value" = type { i32, [5 x i32] }
11%"struct rtx_def" = type { i16, i8, i8, %"union u" }
12%"union u" = type { %"struct real_value" }
13
14define i32 @variable_union(i8** nocapture %slot, i8* nocapture %data) nounwind {
15entry:
16  br i1 undef, label %"4.thread", label %"3"
17
18"4.thread":                                       ; preds = %entry
19  unreachable
20
21"3":                                              ; preds = %entry
22  br i1 undef, label %"19", label %"20"
23
24"19":                                             ; preds = %"3"
25  unreachable
26
27"20":                                             ; preds = %"3"
28  br i1 undef, label %"56.preheader", label %dv_onepart_p.exit
29
30dv_onepart_p.exit:                                ; preds = %"20"
31  unreachable
32
33"56.preheader":                                   ; preds = %"20"
34  br label %"56"
35
36"50":                                             ; preds = %"57"
37  br label %"56"
38
39"56":                                             ; preds = %"50", %"56.preheader"
40  br i1 undef, label %"57", label %"58"
41
42"57":                                             ; preds = %"56"
43  br i1 undef, label %"50", label %"58"
44
45"58":                                             ; preds = %"57", %"56"
46  br i1 undef, label %"62", label %"63"
47
48"62":                                             ; preds = %"58"
49  unreachable
50
51"63":                                             ; preds = %"58"
52  br i1 undef, label %"67", label %"66"
53
54"66":                                             ; preds = %"63"
55  br label %"67"
56
57"67":                                             ; preds = %"66", %"63"
58  br label %"68"
59
60"68":                                             ; preds = %"161", %"67"
61  br i1 undef, label %"153", label %"161"
62
63"153":                                            ; preds = %"68"
64  br i1 undef, label %"160", label %bb.nph46
65
66bb.nph46:                                         ; preds = %"153"
67  br label %"154"
68
69"154":                                            ; preds = %"154", %bb.nph46
70  %0 = phi %"struct location_chain_def"** [ undef, %bb.nph46 ], [ %1, %"154" ] ; <%"struct location_chain_def"**> [#uses=1]
71  %1 = bitcast i8* undef to %"struct location_chain_def"** ; <%"struct location_chain_def"**> [#uses=1]
72  store %"struct location_chain_def"* undef, %"struct location_chain_def"** %0, align 4
73  br i1 undef, label %"160", label %"154"
74
75"160":                                            ; preds = %"154", %"153"
76  br label %"161"
77
78"161":                                            ; preds = %"160", %"68"
79  br label %"68"
80}
81