1 ; RUN: not --crash opt %loadNPMPolly -polly-stmt-granularity=bb -passes=polly-import-jscop -polly-import-jscop-postfix=transformed -disable-output < %s 2>&1 | FileCheck %s
7 ; void ImportArray_Negative_size(double beta, double A[Ni][Nk], double B[Ni][Nj]) {
10 ; for (i = 0; i < Ni; i++) {
11 ; for (j = 0; j < Nj; j++) {
12 ; for (k = 0; k < Nk; ++k) {
13 ; B[i][j] = beta * A[i][k];
19 ; Verify if the JSONImporter checks if the size of the new array is positive.
20 ; CHECK: The size at index 0 is =< 0.
22 ; ModuleID = 'ImportArrays-Negative-size.ll'
24 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
26 ; Function Attrs: nounwind uwtable
27 define void @ImportArrays_Negative_Size(double %beta, ptr nocapture readonly %A, ptr nocapture %B) local_unnamed_addr {
29 br label %for.cond1.preheader
31 for.cond1.preheader: ; preds = %for.inc16, %entry
32 %indvars.iv35 = phi i64 [ 0, %entry ], [ %indvars.iv.next36, %for.inc16 ]
33 br label %for.cond4.preheader
35 for.cond4.preheader: ; preds = %for.inc13, %for.cond1.preheader
36 %indvars.iv32 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next33, %for.inc13 ]
37 %arrayidx12 = getelementptr inbounds [1056 x double], ptr %B, i64 %indvars.iv35, i64 %indvars.iv32
40 for.body6: ; preds = %for.body6, %for.cond4.preheader
41 %indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next.3, %for.body6 ]
42 %arrayidx8 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv
43 %0 = load double, ptr %arrayidx8, align 8
44 %mul = fmul double %0, %beta
45 store double %mul, ptr %arrayidx12, align 8
46 %indvars.iv.next = or disjoint i64 %indvars.iv, 1
47 %arrayidx8.1 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next
48 %1 = load double, ptr %arrayidx8.1, align 8
49 %mul.1 = fmul double %1, %beta
50 store double %mul.1, ptr %arrayidx12, align 8
51 %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
52 %arrayidx8.2 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next.1
53 %2 = load double, ptr %arrayidx8.2, align 8
54 %mul.2 = fmul double %2, %beta
55 store double %mul.2, ptr %arrayidx12, align 8
56 %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
57 %arrayidx8.3 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next.2
58 %3 = load double, ptr %arrayidx8.3, align 8
59 %mul.3 = fmul double %3, %beta
60 store double %mul.3, ptr %arrayidx12, align 8
61 %indvars.iv.next.3 = add nsw i64 %indvars.iv, 4
62 %exitcond.3 = icmp eq i64 %indvars.iv.next.3, 1024
63 br i1 %exitcond.3, label %for.inc13, label %for.body6
65 for.inc13: ; preds = %for.body6
66 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
67 %exitcond34 = icmp eq i64 %indvars.iv.next33, 1056
68 br i1 %exitcond34, label %for.inc16, label %for.cond4.preheader
70 for.inc16: ; preds = %for.inc13
71 %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
72 %exitcond37 = icmp eq i64 %indvars.iv.next36, 1056
73 br i1 %exitcond37, label %for.end18, label %for.cond1.preheader
75 for.end18: ; preds = %for.inc16