[ForwardOpTree] Allow out-of-quota in examination part of forwardTree.
[polly-mirror.git] / test / ScheduleOptimizer / pattern_matching_based_opts_splitmap.ll
blob6433e2c5e422367b2384ac7e710f65d780c3b173
1 ; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-opt-isl -debug-only=polly-opt-isl -disable-output < %s 2>&1 | FileCheck %s
2 ; REQUIRES: asserts
4 ; void pattern_matching_based_opts_splitmap(double C[static const restrict 2][2], double A[static const restrict 2][784], double B[static const restrict 784][2]) {
5 ;  for (int i = 0; i < 2; i+=1)
6 ;    for (int j = 0; j < 2; j+=1)
7 ;      for (int k = 0; k < 784; k+=1)
8 ;        C[i][j] += A[i][k] * B[k][j];
9 ;}
11 ; Check that the pattern matching detects the matrix multiplication pattern
12 ; when the AccMap cannot be reduced to a single disjunct.
14 ; CHECK: The matrix multiplication pattern was detected
16 ; ModuleID = 'pattern_matching_based_opts_splitmap.ll'
18 ; Function Attrs: noinline nounwind uwtable
19 define void @pattern_matching_based_opts_splitmap([2 x double]* noalias dereferenceable(32) %C, [784 x double]* noalias dereferenceable(12544) %A, [2 x double]* noalias dereferenceable(12544) %B) {
20 entry:
21   br label %for.body
23 for.body:                                         ; preds = %entry, %for.inc21
24   %i = phi i64 [ 0, %entry ], [ %add22, %for.inc21 ]
25   br label %for.body3
27 for.body3:                                        ; preds = %for.body, %for.inc18
28   %j = phi i64 [ 0, %for.body ], [ %add19, %for.inc18 ]
29   br label %for.body6
31 for.body6:                                        ; preds = %for.body3, %for.body6
32   %k = phi i64 [ 0, %for.body3 ], [ %add17, %for.body6 ]
33   %arrayidx8 = getelementptr inbounds [784 x double], [784 x double]* %A, i64 %i, i64 %k
34   %tmp6 = load double, double* %arrayidx8, align 8
35   %arrayidx12 = getelementptr inbounds [2 x double], [2 x double]* %B, i64 %k, i64 %j
36   %tmp10 = load double, double* %arrayidx12, align 8
37   %mul = fmul double %tmp6, %tmp10
38   %arrayidx16 = getelementptr inbounds [2 x double], [2 x double]* %C, i64 %i, i64 %j
39   %tmp14 = load double, double* %arrayidx16, align 8
40   %add = fadd double %tmp14, %mul
41   store double %add, double* %arrayidx16, align 8
42   %add17 = add nsw i64 %k, 1
43   %cmp5 = icmp slt i64 %add17, 784
44   br i1 %cmp5, label %for.body6, label %for.inc18
46 for.inc18:                                        ; preds = %for.body6
47   %add19 = add nsw i64 %j, 1
48   %cmp2 = icmp slt i64 %add19, 2
49   br i1 %cmp2, label %for.body3, label %for.inc21
51 for.inc21:                                        ; preds = %for.inc18
52   %add22 = add nsw i64 %i, 1
53   %cmp = icmp slt i64 %add22, 2
54   br i1 %cmp, label %for.body, label %for.end23
56 for.end23:                                        ; preds = %for.inc21
57   ret void