1; RUN: opt < %s -indvars
2; PR4271
3
4target 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:128:128"
5target triple = "i386-apple-darwin10.0"
6	%struct.xyz = type <{ i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, [8 x i8], i64, i64, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [76 x i32], i32, [2 x %struct.uvw] }>
7	%struct.uvw = type <{ i64, i64 }>
8
9define i32 @foo(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
10entry:
11	br label %while.body.i
12
13while.body.i:		; preds = %while.body.i, %entry
14	br i1 undef, label %while.body.i, label %bcopy_internal.exit
15
16bcopy_internal.exit:		; preds = %while.body.i
17	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
18	%shr136 = lshr i32 %conv135, 12		; <i32> [#uses=1]
19	br label %for.body
20
21for.body:		; preds = %for.body, %bcopy_internal.exit
22	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
23	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
24	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
25	br i1 %cmp, label %if.then199, label %for.body
26
27if.then199:		; preds = %if.then199, %for.body
28	br label %if.then199
29}
30
31define i32 @same_thing_but_signed(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
32entry:
33	br label %while.body.i
34
35while.body.i:		; preds = %while.body.i, %entry
36	br i1 undef, label %while.body.i, label %bcopy_internal.exit
37
38bcopy_internal.exit:		; preds = %while.body.i
39	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
40	%shr136 = ashr i32 %conv135, 12		; <i32> [#uses=1]
41	br label %for.body
42
43for.body:		; preds = %for.body, %bcopy_internal.exit
44	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
45	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
46	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
47	br i1 %cmp, label %if.then199, label %for.body
48
49if.then199:		; preds = %if.then199, %for.body
50	br label %if.then199
51}
52
53define i32 @same_thing_but_multiplied(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
54entry:
55	br label %while.body.i
56
57while.body.i:		; preds = %while.body.i, %entry
58	br i1 undef, label %while.body.i, label %bcopy_internal.exit
59
60bcopy_internal.exit:		; preds = %while.body.i
61	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
62	%shr136 = shl i32 %conv135, 12		; <i32> [#uses=1]
63	br label %for.body
64
65for.body:		; preds = %for.body, %bcopy_internal.exit
66	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
67	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
68	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
69	br i1 %cmp, label %if.then199, label %for.body
70
71if.then199:		; preds = %if.then199, %for.body
72	br label %if.then199
73}
74
75define i32 @same_thing_but_xored(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
76entry:
77	br label %while.body.i
78
79while.body.i:		; preds = %while.body.i, %entry
80	br i1 undef, label %while.body.i, label %bcopy_internal.exit
81
82bcopy_internal.exit:		; preds = %while.body.i
83	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
84	%shr136 = xor i32 %conv135, 12		; <i32> [#uses=1]
85	br label %for.body
86
87for.body:		; preds = %for.body, %bcopy_internal.exit
88	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
89	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
90	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
91	br i1 %cmp, label %if.then199, label %for.body
92
93if.then199:		; preds = %if.then199, %for.body
94	br label %if.then199
95}
96