1 ; RUN: opt %loadNPMPolly -passes=polly-opt-isl -polly-pattern-matching-based-opts=true \
2 ; RUN: -polly-tc-opt=true -debug -disable-output < %s 2>&1 | FileCheck %s
5 ; for (int i = 0; i < 32; i++)
6 ; for (int j = 0; j < 32; j++)
7 ; for (int w = 0; w < 32; w++)
8 ; C[i][j] += A[i][w] * B[w][j][i];
10 ; CHECK-NOT: The tensor contraction pattern was detected
12 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
13 target triple = "arm64-apple-macosx12.0.0"
15 define void @foo(ptr noundef %C, ptr noundef %A, ptr noundef %B) {
17 br label %for.cond1.preheader
19 for.cond1.preheader: ; preds = %for.cond.cleanup3, %entry
20 %indvars.iv45 = phi i64 [ 0, %entry ], [ %indvars.iv.next46, %for.cond.cleanup3 ]
21 br label %for.cond5.preheader
23 for.cond.cleanup: ; preds = %for.cond.cleanup3
26 for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond1.preheader
27 %indvars.iv41 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next42, %for.cond.cleanup7 ]
28 %arrayidx20 = getelementptr inbounds [64 x double], ptr %C, i64 %indvars.iv45, i64 %indvars.iv41
29 %.pre = load double, ptr %arrayidx20, align 8
32 for.cond.cleanup3: ; preds = %for.cond.cleanup7
33 %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
34 %exitcond48.not = icmp eq i64 %indvars.iv.next46, 32
35 br i1 %exitcond48.not, label %for.cond.cleanup, label %for.cond1.preheader
37 for.cond.cleanup7: ; preds = %for.body8
38 %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
39 %exitcond44.not = icmp eq i64 %indvars.iv.next42, 32
40 br i1 %exitcond44.not, label %for.cond.cleanup3, label %for.cond5.preheader
42 for.body8: ; preds = %for.body8, %for.cond5.preheader
43 %i = phi double [ %.pre, %for.cond5.preheader ], [ %i3, %for.body8 ]
44 %indvars.iv = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next, %for.body8 ]
45 %arrayidx10 = getelementptr inbounds [64 x double], ptr %A, i64 %indvars.iv45, i64 %indvars.iv
46 %i1 = load double, ptr %arrayidx10, align 8
47 %arrayidx16 = getelementptr inbounds [64 x [64 x double]], ptr %B, i64 %indvars.iv, i64 %indvars.iv41, i64 %indvars.iv45
48 %i2 = load double, ptr %arrayidx16, align 8
49 %i3 = tail call double @llvm.fmuladd.f64(double %i1, double %i2, double %i)
50 store double %i3, ptr %arrayidx20, align 8
51 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
52 %exitcond.not = icmp eq i64 %indvars.iv.next, 32
53 br i1 %exitcond.not, label %for.cond.cleanup7, label %for.body8
56 declare double @llvm.fmuladd.f64(double, double, double)