1; RUN: opt %loadPolly -S -polly-codegen < %s | FileCheck %s
2;
3; Check that we do not crash as described here: http://llvm.org/PR21167
4;
5; In case the pieceweise affine function used to create an isl_ast_expr
6; had empty cases (e.g., with contradicting constraints on the
7; parameters), it was possible that the condition of the isl_ast_expr
8; select was not a comparison but a constant (thus of type i64).
9; However, we shouldn't crash in such a case :)
10;
11; CHECK: polly.split_new_and_old
12;
13target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14
15; Function Attrs: nounwind uwtable
16define void @dradb4(i32 %ido, i32 %l1, float* %cc, float* %ch, float* %wa1, float* %wa3) #0 {
17entry:
18  %mul = mul nsw i32 %l1, %ido
19  br i1 undef, label %for.end256, label %if.end
20
21if.end:                                           ; preds = %entry
22  br i1 undef, label %L105, label %for.cond45.preheader
23
24for.cond45.preheader:                             ; preds = %if.end
25  br i1 undef, label %for.body47, label %for.end198
26
27for.body47:                                       ; preds = %for.inc096, %for.cond45.preheader
28  br i1 undef, label %for.body53.lr.ph, label %for.inc096
29
30for.body53.lr.ph:                                 ; preds = %for.body47
31  br label %for.body53
32
33for.body53:                                       ; preds = %for.body53, %for.body53.lr.ph
34  %t7.014 = phi i32 [ 0, %for.body53.lr.ph ], [ %add58, %for.body53 ]
35  %i.013 = phi i32 [ 2, %for.body53.lr.ph ], [ %add193, %for.body53 ]
36  %add58 = add nsw i32 %t7.014, 2
37  %arrayidx70 = getelementptr inbounds float, float* %cc, i64 0
38  %arrayidx72 = getelementptr inbounds float, float* %cc, i64 0
39  %arrayidx77 = getelementptr inbounds float, float* %cc, i64 0
40  %arrayidx81 = getelementptr inbounds float, float* %cc, i64 0
41  %arrayidx84 = getelementptr inbounds float, float* %cc, i64 0
42  %arrayidx95 = getelementptr inbounds float, float* %cc, i64 0
43  %arrayidx105 = getelementptr inbounds float, float* %cc, i64 0
44  %arrayidx110 = getelementptr inbounds float, float* %ch, i64 0
45  store float undef, float* %arrayidx110, align 4
46  %arrayidx122 = getelementptr inbounds float, float* %wa1, i64 0
47  %add129 = add nsw i32 %add58, %mul
48  %idxprom142 = sext i32 %add129 to i64
49  %arrayidx143 = getelementptr inbounds float, float* %ch, i64 %idxprom142
50  store float undef, float* %arrayidx143, align 4
51  %add153 = add nsw i32 %add129, %mul
52  %arrayidx170 = getelementptr inbounds float, float* %wa3, i64 0
53  %arrayidx174 = getelementptr inbounds float, float* %wa3, i64 0
54  %add177 = add nsw i32 %add153, %mul
55  %sub178 = add nsw i32 %add177, -1
56  %idxprom179 = sext i32 %sub178 to i64
57  %arrayidx180 = getelementptr inbounds float, float* %ch, i64 %idxprom179
58  store float undef, float* %arrayidx180, align 4
59  %arrayidx183 = getelementptr inbounds float, float* %wa3, i64 0
60  %0 = load float, float* %arrayidx183, align 4
61  %mul184 = fmul float undef, %0
62  %add189 = fadd float %mul184, 0.000000e+00
63  %idxprom190 = sext i32 %add177 to i64
64  %arrayidx191 = getelementptr inbounds float, float* %ch, i64 %idxprom190
65  store float %add189, float* %arrayidx191, align 4
66  %add193 = add nsw i32 %i.013, 2
67  %cmp52 = icmp slt i32 %add193, %ido
68  br i1 %cmp52, label %for.body53, label %for.inc096
69
70for.inc096:                                       ; preds = %for.body53, %for.body47
71  br i1 undef, label %for.body47, label %for.end198
72
73for.end198:                                       ; preds = %for.inc096, %for.cond45.preheader
74  br i1 false, label %for.end256, label %L105
75
76L105:                                             ; preds = %for.end198, %if.end
77  br label %for.end256
78
79for.end256:                                       ; preds = %L105, %for.end198, %entry
80  ret void
81}
82