brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.9 KiB · 1d3a789 Raw
127 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<flatten;delicm>' -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s2; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<flatten;delicm>' -polly-delicm-partial-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck -check-prefix=PARTIAL %s3;4;    void func(double *A) {5;      for (int j = 0; j < 2; j += 1) { /* outer */6;        double phi = 0.0;7;        for (int i = 0; i < 4; i += 1) { /* reduction */8;          phi += 4.2;9;          A[j] = phi;10;        }11;      }12;    }13;14define void @func(ptr noalias nonnull %A) {15entry:16  br label %outer.preheader17 18outer.preheader:19  br label %outer.for20 21outer.for:22  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]23  %j.cmp = icmp slt i32 %j, 224  br i1 %j.cmp, label %reduction.preheader, label %outer.exit25 26 27    reduction.preheader:28      br label %reduction.for29 30    reduction.for:31      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]32      %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]33      br label %body34 35 36 37        body:38          %add = fadd double %phi, 4.239          %A_idx = getelementptr inbounds double, ptr %A, i32 %j40          store double %add, ptr %A_idx41          br label %reduction.inc42 43 44 45    reduction.inc:46      %i.inc = add nuw nsw i32 %i, 147      %i.cmp = icmp slt i32 %i.inc, 448      br i1 %i.cmp, label %reduction.for, label %reduction.exit49 50    reduction.exit:51      br label %outer.inc52 53 54 55outer.inc:56  %j.inc = add nuw nsw i32 %j, 157  br label %outer.for58 59outer.exit:60  br label %return61 62return:63  ret void64}65 66 67; CHECK:      After accesses {68; CHECK-NEXT:    Stmt_reduction_preheader69; CHECK-NEXT:            MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]70; CHECK-NEXT:                 { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };71; CHECK-NEXT:            new: { Stmt_reduction_preheader[i0] -> MemRef_A[i0] };72; CHECK-NEXT:     Stmt_reduction_for73; CHECK-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]74; CHECK-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };75; CHECK-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };76; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]77; CHECK-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };78; CHECK-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };79; CHECK-NEXT:     Stmt_body80; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]81; CHECK-NEXT:                 { Stmt_body[i0, i1] -> MemRef_add[] };82; CHECK-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[i0] };83; CHECK-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]84; CHECK-NEXT:                 { Stmt_body[i0, i1] -> MemRef_phi[] };85; CHECK-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[i0] : 3i1 <= 21 - 13i0; Stmt_body[1, 3] -> MemRef_A[1] };86; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]87; CHECK-NEXT:                 { Stmt_body[i0, i1] -> MemRef_A[i0] };88; CHECK-NEXT:     Stmt_reduction_inc89; CHECK-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]90; CHECK-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };91; CHECK-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 3i1 <= 21 - 13i0; Stmt_reduction_inc[1, 3] -> MemRef_A[1] };92; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]93; CHECK-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };94; CHECK-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };95; CHECK-NEXT: }96 97 98; PARTIAL:      After accesses {99; PARTIAL-NEXT:     Stmt_reduction_preheader100; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]101; PARTIAL-NEXT:                 { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };102; PARTIAL-NEXT:            new: { Stmt_reduction_preheader[i0] -> MemRef_A[i0] };103; PARTIAL-NEXT:     Stmt_reduction_for104; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]105; PARTIAL-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };106; PARTIAL-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };107; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]108; PARTIAL-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };109; PARTIAL-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };110; PARTIAL-NEXT:     Stmt_body111; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]112; PARTIAL-NEXT:                 { Stmt_body[i0, i1] -> MemRef_add[] };113; PARTIAL-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[i0] };114; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]115; PARTIAL-NEXT:                 { Stmt_body[i0, i1] -> MemRef_phi[] };116; PARTIAL-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[i0] : 3i1 <= 21 - 13i0; Stmt_body[1, 3] -> MemRef_A[1] };117; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]118; PARTIAL-NEXT:                 { Stmt_body[i0, i1] -> MemRef_A[i0] };119; PARTIAL-NEXT:     Stmt_reduction_inc120; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]121; PARTIAL-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };122; PARTIAL-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 3i1 <= 21 - 13i0; Stmt_reduction_inc[1, 3] -> MemRef_A[1] };123; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]124; PARTIAL-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };125; PARTIAL-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : i1 <= 2 };126; PARTIAL-NEXT: }127