1; RUN: opt %loadPolly \
2; RUN:     -polly-codegen -S < %s | FileCheck %s
3
4; This test cases used to crash the scalar code generation. Check that we
5; can generate code for it.
6
7; CHECK: polly.start
8@endposition = external global i32, align 4
9@Bit = external global [0 x i32], align 4
10@Init = external global [0 x i32], align 4
11
12define void @maskgen() {
13entry:
14  br label %for.body
15
16for.body:                                         ; preds = %for.body, %entry
17  br i1 undef, label %for.end.310, label %for.body
18
19for.end.310:                                      ; preds = %for.body
20  store i32 undef, i32* @endposition, align 4
21  %sub325 = sub i32 33, 0
22  %0 = load i32, i32* getelementptr inbounds ([0 x i32], [0 x i32]* @Init, i64 0, i64 0), align 4
23  br i1 false, label %for.cond.347.preheader, label %for.body.328.lr.ph
24
25for.body.328.lr.ph:                               ; preds = %for.end.310
26  %1 = sub i32 34, 0
27  br label %for.body.328
28
29for.body.328:                                     ; preds = %for.body.328, %for.body.328.lr.ph
30  %indvars.iv546 = phi i64 [ %indvars.iv.next547, %for.body.328 ], [ 1, %for.body.328.lr.ph ]
31  %2 = phi i32 [ %or331, %for.body.328 ], [ %0, %for.body.328.lr.ph ]
32  %arrayidx330 = getelementptr inbounds [0 x i32], [0 x i32]* @Bit, i64 0, i64 %indvars.iv546
33  %3 = load i32, i32* %arrayidx330, align 4
34  %or331 = or i32 %3, %2
35  %indvars.iv.next547 = add nuw nsw i64 %indvars.iv546, 1
36  %lftr.wideiv = trunc i64 %indvars.iv.next547 to i32
37  %exitcond14 = icmp eq i32 %lftr.wideiv, %1
38  br i1 %exitcond14, label %for.cond.347.preheader, label %for.body.328
39
40for.cond.347.preheader:                           ; preds = %for.cond.347.preheader, %for.body.328, %for.end.310
41  br i1 undef, label %if.end.471, label %for.cond.347.preheader
42
43if.end.471:                                       ; preds = %for.cond.347.preheader
44  ret void
45}
46