1; RUN: opt %loadNPMPolly -passes=polly-codegen < %s
2;
3; Check we do not crash even though there is a dead load that is referenced by
4; a parameter and we do not pre-load it (as it is dead).
5;
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7
8@REGISTER = external global [10 x i32], align 16
9
10; Function Attrs: nounwind uwtable
11define void @FORMAT3_4() #0 {
12entry:
13  %INSTR = alloca [32 x i32], align 16
14  br label %entry.split
15
16entry.split:                                      ; preds = %entry
17  %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @REGISTER, i64 0, i64 8), align 16
18  %add = add nsw i32 %0, 2
19  %cmp = icmp sgt i32 %add, 1048575
20  br i1 %cmp, label %if.end.36, label %if.else
21
22if.else:                                          ; preds = %entry.split
23  call void (i32, i32, ptr, ...) @BYTES_TO_BITS(i32 undef, i32 1, ptr undef) #2
24  %1 = load i32, ptr undef, align 4
25  %cmp14 = icmp eq i32 %1, 1
26  br i1 %cmp14, label %land.lhs.true, label %if.end.36
27
28land.lhs.true:                                    ; preds = %if.else
29  %arrayidx16 = getelementptr inbounds [32 x i32], ptr %INSTR, i64 0, i64 6
30  br i1 false, label %land.lhs.true.19, label %if.then.23
31
32land.lhs.true.19:                                 ; preds = %land.lhs.true
33  %arrayidx20 = getelementptr inbounds [32 x i32], ptr %INSTR, i64 0, i64 7
34  br i1 false, label %if.end.36, label %if.then.23
35
36if.then.23:                                       ; preds = %land.lhs.true.19, %land.lhs.true
37  br i1 false, label %if.end.36, label %if.else.28
38
39if.else.28:                                       ; preds = %if.then.23
40  br label %if.end.36
41
42if.end.36:                                        ; preds = %if.else.28, %if.then.23, %land.lhs.true.19, %if.else, %entry.split
43  %RANGE_ERROR.0 = phi i1 [ false, %land.lhs.true.19 ], [ false, %if.else.28 ], [ false, %if.else ], [ true, %entry.split ], [ true, %if.then.23 ]
44  br i1 %RANGE_ERROR.0, label %if.then.37, label %if.end.38
45
46if.then.37:                                       ; preds = %if.end.36
47  br label %return
48
49if.end.38:                                        ; preds = %if.end.36
50  br i1 undef, label %land.lhs.true.43, label %if.else.50
51
52land.lhs.true.43:                                 ; preds = %if.end.38
53  br i1 undef, label %if.then.47, label %if.else.50
54
55if.then.47:                                       ; preds = %land.lhs.true.43
56  br label %if.end.107
57
58if.else.50:                                       ; preds = %land.lhs.true.43, %if.end.38
59  br i1 undef, label %if.then.53, label %if.else.89
60
61if.then.53:                                       ; preds = %if.else.50
62  br i1 undef, label %land.lhs.true.59, label %if.end.64
63
64land.lhs.true.59:                                 ; preds = %if.then.53
65  br i1 undef, label %if.then.63, label %if.end.64
66
67if.then.63:                                       ; preds = %land.lhs.true.59
68  br label %return
69
70if.end.64:                                        ; preds = %land.lhs.true.59, %if.then.53
71  br i1 undef, label %if.then.80, label %if.end.107
72
73if.then.80:                                       ; preds = %if.end.64
74  br i1 undef, label %if.then.83, label %if.else.85
75
76if.then.83:                                       ; preds = %if.then.80
77  br label %if.end.107
78
79if.else.85:                                       ; preds = %if.then.80
80  br label %if.end.107
81
82if.else.89:                                       ; preds = %if.else.50
83  br i1 undef, label %if.then.96, label %lor.lhs.false
84
85lor.lhs.false:                                    ; preds = %if.else.89
86  br i1 undef, label %if.then.96, label %if.end.97
87
88if.then.96:                                       ; preds = %lor.lhs.false, %if.else.89
89  br label %return
90
91if.end.97:                                        ; preds = %lor.lhs.false
92  br i1 undef, label %if.then.103, label %if.end.107
93
94if.then.103:                                      ; preds = %if.end.97
95  br label %if.end.107
96
97if.end.107:                                       ; preds = %if.then.103, %if.end.97, %if.else.85, %if.then.83, %if.end.64, %if.then.47
98  br i1 undef, label %land.lhs.true.111, label %if.end.142
99
100land.lhs.true.111:                                ; preds = %if.end.107
101  br i1 undef, label %if.then.115, label %if.end.142
102
103if.then.115:                                      ; preds = %land.lhs.true.111
104  br i1 undef, label %if.then.118, label %return
105
106if.then.118:                                      ; preds = %if.then.115
107  br i1 undef, label %if.then.125, label %for.cond.preheader
108
109for.cond.preheader:                               ; preds = %if.then.118
110  br i1 undef, label %for.body.lr.ph, label %for.end
111
112for.body.lr.ph:                                   ; preds = %for.cond.preheader
113  br label %for.body
114
115if.then.125:                                      ; preds = %if.then.118
116  br label %return
117
118for.body:                                         ; preds = %for.body, %for.body.lr.ph
119  br i1 undef, label %for.body, label %for.cond.for.end_crit_edge
120
121for.cond.for.end_crit_edge:                       ; preds = %for.body
122  br label %for.end
123
124for.end:                                          ; preds = %for.cond.for.end_crit_edge, %for.cond.preheader
125  br label %return
126
127if.end.142:                                       ; preds = %land.lhs.true.111, %if.end.107
128  br i1 undef, label %land.lhs.true.146, label %if.end.206
129
130land.lhs.true.146:                                ; preds = %if.end.142
131  br i1 undef, label %if.then.150, label %if.end.206
132
133if.then.150:                                      ; preds = %land.lhs.true.146
134  br i1 undef, label %if.then.157, label %lor.lhs.false.153
135
136lor.lhs.false.153:                                ; preds = %if.then.150
137  br i1 undef, label %if.then.157, label %if.end.158
138
139if.then.157:                                      ; preds = %lor.lhs.false.153, %if.then.150
140  br label %return
141
142if.end.158:                                       ; preds = %lor.lhs.false.153
143  br i1 undef, label %if.then.179, label %return
144
145if.then.179:                                      ; preds = %if.end.158
146  br i1 undef, label %if.then.183, label %for.cond.185.preheader
147
148for.cond.185.preheader:                           ; preds = %if.then.179
149  br i1 undef, label %for.body.188.lr.ph, label %for.end.198
150
151for.body.188.lr.ph:                               ; preds = %for.cond.185.preheader
152  br label %for.body.188
153
154if.then.183:                                      ; preds = %if.then.179
155  br label %return
156
157for.body.188:                                     ; preds = %for.body.188, %for.body.188.lr.ph
158  br i1 undef, label %for.body.188, label %for.cond.185.for.end.198_crit_edge
159
160for.cond.185.for.end.198_crit_edge:               ; preds = %for.body.188
161  br label %for.end.198
162
163for.end.198:                                      ; preds = %for.cond.185.for.end.198_crit_edge, %for.cond.185.preheader
164  br label %return
165
166if.end.206:                                       ; preds = %land.lhs.true.146, %if.end.142
167  br i1 undef, label %land.lhs.true.210, label %return
168
169land.lhs.true.210:                                ; preds = %if.end.206
170  br i1 undef, label %if.then.214, label %return
171
172if.then.214:                                      ; preds = %land.lhs.true.210
173  br i1 undef, label %if.then.219, label %return
174
175if.then.219:                                      ; preds = %if.then.214
176  br label %return
177
178return:                                           ; preds = %if.then.219, %if.then.214, %land.lhs.true.210, %if.end.206, %for.end.198, %if.then.183, %if.end.158, %if.then.157, %for.end, %if.then.125, %if.then.115, %if.then.96, %if.then.63, %if.then.37
179  ret void
180}
181
182declare void @BYTES_TO_BITS(...) #1
183
184attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="haswell" "target-features"="+aes,+avx,+avx2,+bmi,+bmi2,+cmov,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+hle,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+rdrnd,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt,-adx,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-fma4,-prfchw,-rdseed,-sha,-sse4a,-tbm,-xop,-xsavec,-xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
185attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="haswell" "target-features"="+aes,+avx,+avx2,+bmi,+bmi2,+cmov,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+hle,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+rdrnd,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt,-adx,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-fma4,-prfchw,-rdseed,-sha,-sse4a,-tbm,-xop,-xsavec,-xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" }
186attributes #2 = { nounwind }
187