brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.0 KiB · d6cbb70 Raw
159 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<flatten;delicm>' -polly-delicm-compute-known=true -polly-delicm-overapproximate-writes=true -polly-delicm-partial-writes=false -polly-print-delicm -disable-output < %s | FileCheck %s --check-prefix=APPROX2; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<flatten;delicm>' -polly-delicm-compute-known=true -polly-delicm-overapproximate-writes=false -polly-delicm-partial-writes=false -polly-print-delicm -disable-output < %s | FileCheck %s --check-prefix=EXACT3; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<flatten;delicm>' -polly-delicm-compute-known=true -polly-delicm-partial-writes=true -polly-print-delicm -disable-output < %s | FileCheck %s --check-prefix=PARTIAL4;5;    void func(double *A {6;      for (int j = -1; j < 3; j += 1) { /* outer */7;        double phi = 0.0;8;        if (0 < j)9;          for (int i = 0; i < j; i += 1) /* reduction */10;            phi += 4.2;11;        A[j] = phi;12;      }13;    }14;15define void @func(ptr noalias nonnull %A) {16entry:17  br label %outer.preheader18 19outer.preheader:20  br label %outer.for21 22outer.for:23  %j = phi i32 [-1, %outer.preheader], [%j.inc, %outer.inc]24  %j.cmp = icmp slt i32 %j, 325  br i1 %j.cmp, label %reduction.checkloop, label %outer.exit26 27 28 29    reduction.checkloop:30      %j2.cmp = icmp slt i32 0, %j31      br i1 %j2.cmp, label %reduction.preheader, label %reduction.exit32 33    reduction.preheader:34      br label %reduction.for35 36    reduction.for:37      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]38      %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]39      br label %body40 41 42 43        body:44          %add = fadd double %phi, 4.245          br label %reduction.inc46 47 48 49    reduction.inc:50      %i.inc = add nuw nsw i32 %i, 151      %i.cmp = icmp slt i32 %i.inc, %j52      br i1 %i.cmp, label %reduction.for, label %reduction.exit53 54    reduction.exit:55      %val = phi double [%add, %reduction.inc], [0.0, %reduction.checkloop]56      %A_idx = getelementptr inbounds double, ptr %A, i32 %j57      store double %val, ptr %A_idx58      br label %outer.inc59 60 61 62outer.inc:63  %j.inc = add nuw nsw i32 %j, 164  br label %outer.for65 66outer.exit:67  br label %return68 69return:70  ret void71}72 73 74; APPROX:      After accesses {75; APPROX-NEXT:     Stmt_reduction_checkloop76; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]77; APPROX-NEXT:                 { Stmt_reduction_checkloop[i0] -> MemRef_val__phi[] };78; APPROX-NEXT:            new: { Stmt_reduction_checkloop[i0] -> MemRef_A[-1 + i0] };79; APPROX-NEXT:     Stmt_reduction_preheader80; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]81; APPROX-NEXT:                 { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };82; APPROX-NEXT:            new: { Stmt_reduction_preheader[i0] -> MemRef_A[-1 + i0] };83; APPROX-NEXT:     Stmt_reduction_for84; APPROX-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]85; APPROX-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };86; APPROX-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[-1 + i0] };87; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]88; APPROX-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };89; APPROX-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[-1 + i0] };90; APPROX-NEXT:     Stmt_body91; APPROX-NEXT:            MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]92; APPROX-NEXT:                { Stmt_body[i0, i1] -> MemRef_add[] };93; APPROX-NEXT:           new: { Stmt_body[i0, i1] -> MemRef_A[-1 + i0] };94; APPROX-NEXT:            ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]95; APPROX-NEXT:                { Stmt_body[i0, i1] -> MemRef_phi[] };96; APPROX-NEXT:           new: { Stmt_body[i0, i1] -> MemRef_A[-1 + i0] };97; APPROX-NEXT:     Stmt_reduction_inc98; APPROX-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]99; APPROX-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };100; APPROX-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[-1 + i0] };101; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]102; APPROX-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };103; APPROX-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[2] };104; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]105; APPROX-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_val__phi[] };106; APPROX-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[-1 + i0] };107; APPROX-NEXT:     Stmt_reduction_exit108; APPROX-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]109; APPROX-NEXT:                 { Stmt_reduction_exit[i0] -> MemRef_val__phi[] };110; APPROX-NEXT:            new: { Stmt_reduction_exit[i0] -> MemRef_A[-1 + i0] };111; APPROX-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]112; APPROX-NEXT:                 { Stmt_reduction_exit[i0] -> MemRef_A[-1 + i0] };113; APPROX-NEXT: }114 115 116; EXACT: No modification has been made117 118 119; PARTIAL:      After accesses {120; PARTIAL-NEXT:     Stmt_reduction_checkloop121; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]122; PARTIAL-NEXT:                 { Stmt_reduction_checkloop[i0] -> MemRef_val__phi[] };123; PARTIAL-NEXT:            new: { Stmt_reduction_checkloop[i0] -> MemRef_A[-1 + i0] : i0 <= 1 };124; PARTIAL-NEXT:     Stmt_reduction_preheader125; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]126; PARTIAL-NEXT:                 { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };127; PARTIAL-NEXT:            new: { Stmt_reduction_preheader[i0] -> MemRef_A[-1 + i0] };128; PARTIAL-NEXT:     Stmt_reduction_for129; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]130; PARTIAL-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };131; PARTIAL-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[-1 + i0] };132; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]133; PARTIAL-NEXT:                 { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };134; PARTIAL-NEXT:            new: { Stmt_reduction_for[i0, i1] -> MemRef_A[-1 + i0] };135; PARTIAL-NEXT:     Stmt_body136; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]137; PARTIAL-NEXT:                 { Stmt_body[i0, i1] -> MemRef_add[] };138; PARTIAL-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[-1 + i0] };139; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]140; PARTIAL-NEXT:                 { Stmt_body[i0, i1] -> MemRef_phi[] };141; PARTIAL-NEXT:            new: { Stmt_body[i0, i1] -> MemRef_A[-1 + i0] };142; PARTIAL-NEXT:     Stmt_reduction_inc143; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]144; PARTIAL-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };145; PARTIAL-NEXT:            new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[-1 + i0] };146; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]147; PARTIAL-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };148; PARTIAL-NEXT:            new: { Stmt_reduction_inc[3, 0] -> MemRef_A[2] };149; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]150; PARTIAL-NEXT:                 { Stmt_reduction_inc[i0, i1] -> MemRef_val__phi[] };151; PARTIAL-NEXT:            new: { Stmt_reduction_inc[i0, -2 + i0] -> MemRef_A[-1 + i0] };152; PARTIAL-NEXT:     Stmt_reduction_exit153; PARTIAL-NEXT:             ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]154; PARTIAL-NEXT:                 { Stmt_reduction_exit[i0] -> MemRef_val__phi[] };155; PARTIAL-NEXT:            new: { Stmt_reduction_exit[i0] -> MemRef_A[-1 + i0] };156; PARTIAL-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]157; PARTIAL-NEXT:                 { Stmt_reduction_exit[i0] -> MemRef_A[-1 + i0] };158; PARTIAL-NEXT: }159