1; RUN: opt %loadNPMPolly \ 2; RUN: -polly-pattern-matching-based-opts=true \ 3; RUN: '-passes=polly-optree,polly-delicm,polly-simplify,polly-opt-isl' \ 4; RUN: -polly-tc-opt=true -debug -disable-output < %s 2>&1 \ 5; RUN: | FileCheck %s 6; REQUIRES: asserts 7 8; Check that the pattern matching detects the matrix multiplication pattern 9; after a full run of -polly-optree and -polly-delicm, where the write access 10; is not through the original memory access, but through a PHI node that was 11; delicmed. This test covers the polybench 2mm and 3mm cases. 12; 13; This test case generates the following schedule, which contains filters: 14; 15; domain: "{ Stmt_for_body8[i0, i1, i2] : 0 <= i0 <= 1599 and 16; 0 <= i1 <= 1799 and 17; 0 <= i2 <= 2199; 18; Stmt_for_body3[i0, i1] : 0 <= i0 <= 1599 and 19; 0 <= i1 <= 1799; 20; Stmt_for_body3_last[i0, i1] : 0 <= i0 <= 1599 and 21; 0 <= i1 <= 1799 }" 22; child: 23; sequence: 24; - filter: "{ Stmt_for_body3[i0, i1] }" 25; child: 26; schedule: "[{ Stmt_for_body3[i0, i1] -> [(i0)] }, { Stmt_for_body3[i0, i1] -> [(i1)] }]" 27; permutable: 1 28; coincident: [ 1, 1 ] 29; - filter: "{ Stmt_for_body3_last[i0, i1] }" 30; child: 31; schedule: "[{ Stmt_for_body3_last[i0, i1] -> [(i0)] }, { Stmt_for_body3_last[i0, i1] -> [(i1)] }]" 32; permutable: 1 33; coincident: [ 1, 1 ] 34; - filter: "{ Stmt_for_body8[i0, i1, i2] }" 35; child: 36; schedule: "[{ Stmt_for_body8[i0, i1, i2] -> [(i0)] }, 37; { Stmt_for_body8[i0, i1, i2] -> [(i1)] }, 38; { Stmt_for_body8[i0, i1, i2] -> [(i2)] }]" 39; permutable: 1 40; coincident: [ 1, 1, 0 ] 41; 42; CHECK: The tensor contraction pattern was detected 43; CHECK: The matrix multiplication pattern was detected 44; 45 46target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 47target triple = "x86_64-unknown-linux-gnu" 48 49; Function Attrs: norecurse nounwind uwtable 50define void @kernel_2mm(i32 %ni, i32 %nj, i32 %nk, i32 %nl, double %alpha, double %beta, ptr nocapture %tmp, ptr nocapture readonly %A, ptr nocapture readonly %B, ptr nocapture readnone %C, ptr nocapture readnone %D) local_unnamed_addr #0 { 51entry: 52 br label %entry.split 53 54entry.split: ; preds = %entry 55 br label %for.body 56 57for.body: ; preds = %for.inc25, %entry.split 58 %indvars.iv50 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next51, %for.inc25 ] 59 br label %for.body3 60 61for.body3: ; preds = %for.inc22, %for.body 62 %indvars.iv46 = phi i64 [ 0, %for.body ], [ %indvars.iv.next47, %for.inc22 ] 63 %arrayidx5 = getelementptr inbounds [1800 x double], ptr %tmp, i64 %indvars.iv50, i64 %indvars.iv46 64 store double 0.000000e+00, ptr %arrayidx5, align 8, !tbaa !2 65 br label %for.body8 66 67for.body8: ; preds = %for.body8, %for.body3 68 %0 = phi double [ 0.000000e+00, %for.body3 ], [ %add, %for.body8 ] 69 %indvars.iv = phi i64 [ 0, %for.body3 ], [ %indvars.iv.next, %for.body8 ] 70 %arrayidx12 = getelementptr inbounds [2200 x double], ptr %A, i64 %indvars.iv50, i64 %indvars.iv 71 %1 = load double, ptr %arrayidx12, align 8, !tbaa !2 72 %mul = fmul double %1, %alpha 73 %arrayidx16 = getelementptr inbounds [1800 x double], ptr %B, i64 %indvars.iv, i64 %indvars.iv46 74 %2 = load double, ptr %arrayidx16, align 8, !tbaa !2 75 %mul17 = fmul double %mul, %2 76 %add = fadd double %0, %mul17 77 store double %add, ptr %arrayidx5, align 8, !tbaa !2 78 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 79 %exitcond = icmp eq i64 %indvars.iv.next, 2200 80 br i1 %exitcond, label %for.inc22, label %for.body8 81 82for.inc22: ; preds = %for.body8 83 %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 84 %exitcond48 = icmp eq i64 %indvars.iv.next47, 1800 85 br i1 %exitcond48, label %for.inc25, label %for.body3 86 87for.inc25: ; preds = %for.inc22 88 %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 89 %exitcond52 = icmp eq i64 %indvars.iv.next51, 1600 90 br i1 %exitcond52, label %for.end27, label %for.body 91 92for.end27: ; preds = %for.inc25 93 ret void 94} 95 96attributes #0 = { norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="haswell" "target-features"="+aes,+avx,+avx2,+bmi,+bmi2,+cmov,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-adx,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-avx512vpopcntdq,-clflushopt,-clwb,-clzero,-fma4,-lwp,-mwaitx,-pku,-prefetchwt1,-prfchw,-rdseed,-rtm,-sgx,-sha,-sse4a,-tbm,-xop,-xsavec,-xsaves" "unsafe-fp-math"="false" "use-soft-float"="false" } 97 98!llvm.module.flags = !{!0} 99!llvm.ident = !{!1} 100 101!0 = !{i32 1, !"wchar_size", i32 4} 102!1 = !{!"clang version 6.0.0 (trunk 309912) (llvm/trunk 309933)"} 103!2 = !{!3, !3, i64 0} 104!3 = !{!"double", !4, i64 0} 105!4 = !{!"omnipotent char", !5, i64 0} 106!5 = !{!"Simple C/C++ TBAA"} 107