xref: /llvm-project/polly/test/CodeGen/test-invalid-operands-for-select.ll (revision 5aafc6d58f3405662902cee006be11e599801b88)
1; RUN: opt %loadNPMPolly -S -passes=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 piecewise 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, ptr %cc, ptr %ch, ptr %wa1, ptr %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  store float undef, ptr %ch, align 4
38  %add129 = add nsw i32 %add58, %mul
39  %idxprom142 = sext i32 %add129 to i64
40  %arrayidx143 = getelementptr inbounds float, ptr %ch, i64 %idxprom142
41  store float undef, ptr %arrayidx143, align 4
42  %add153 = add nsw i32 %add129, %mul
43  %add177 = add nsw i32 %add153, %mul
44  %sub178 = add nsw i32 %add177, -1
45  %idxprom179 = sext i32 %sub178 to i64
46  %arrayidx180 = getelementptr inbounds float, ptr %ch, i64 %idxprom179
47  store float undef, ptr %arrayidx180, align 4
48  %0 = load float, ptr %wa3, align 4
49  %mul184 = fmul float undef, %0
50  %add189 = fadd float %mul184, 0.000000e+00
51  %idxprom190 = sext i32 %add177 to i64
52  %arrayidx191 = getelementptr inbounds float, ptr %ch, i64 %idxprom190
53  store float %add189, ptr %arrayidx191, align 4
54  %add193 = add nsw i32 %i.013, 2
55  %cmp52 = icmp slt i32 %add193, %ido
56  br i1 %cmp52, label %for.body53, label %for.inc096
57
58for.inc096:                                       ; preds = %for.body53, %for.body47
59  br i1 undef, label %for.body47, label %for.end198
60
61for.end198:                                       ; preds = %for.inc096, %for.cond45.preheader
62  br i1 false, label %for.end256, label %L105
63
64L105:                                             ; preds = %for.end198, %if.end
65  br label %for.end256
66
67for.end256:                                       ; preds = %L105, %for.end198, %entry
68  ret void
69}
70