brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 7dc6e0f Raw
102 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb -polly-invariant-load-hoisting '-passes=polly-custom<flatten;delicm>' -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s2;3;    void func(int *A, int* StartPtr) {4;      for (int j = 0; j < 2; j += 1) { /* outer */5;        int Start = *Startptr;6;        int phi = Start;7;        for (int i = Start; i < 4; i += 1) /* reduction */8;          phi += 42;9;        A[j] = phi;10;      }11;    }12;13define void @func(ptr noalias nonnull %A, ptr noalias nonnull %StartPtr) {14entry:15  br label %outer.preheader16 17outer.preheader:18  br label %outer.for19 20outer.for:21  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]22  %j.cmp = icmp slt i32 %j, 223  br i1 %j.cmp, label %reduction.preheader, label %outer.exit24 25 26    reduction.preheader:27      %Start = load i32, ptr %StartPtr28      br label %reduction.for29 30    reduction.for:31      %i = phi i32 [%Start, %reduction.preheader], [%i.inc, %reduction.inc]32      %phi = phi i32 [%Start, %reduction.preheader], [%mul, %reduction.inc]33      br label %body34 35 36 37        body:38          %mul = mul i32 %phi, 239          br label %reduction.inc40 41 42 43    reduction.inc:44      %i.inc = add nuw nsw i32 %i, 145      %i.cmp = icmp slt i32 %i.inc, 446      br i1 %i.cmp, label %reduction.for, label %reduction.exit47 48    reduction.exit:49      %A_idx = getelementptr inbounds i32, ptr %A, i32 %j50      store i32 %mul, ptr %A_idx51      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; FIXME: The accesses for %i should not be there because, with67; load-hoisting %Start is an affine loop. To be fixed in ScopBuilder.68 69; CHECK:      After accesses {70; CHECK-NEXT:     Stmt_reduction_preheader71; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]72; CHECK-NEXT:                 [Start] -> { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };73; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_preheader[i0] -> MemRef_A[i0] };74; CHECK-NEXT:     Stmt_reduction_for75; CHECK-NEXT:             ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]76; CHECK-NEXT:                 [Start] -> { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };77; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] : -i0 < i1 <= 3 - Start; Stmt_reduction_for[1, 0] -> MemRef_A[1] : Start >= 4; Stmt_reduction_for[0, 0] -> MemRef_A[0] };78; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]79; CHECK-NEXT:                 [Start] -> { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };80; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] : i0 <= i1 <= 3 - Start; Stmt_reduction_for[i0, 0] -> MemRef_A[i0] : i0 <= -4 + Start; Stmt_reduction_for[1, 0] -> MemRef_A[1] : Start <= 4 }81; CHECK-NEXT:     Stmt_body82; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]83; CHECK-NEXT:                 [Start] -> { Stmt_body[i0, i1] -> MemRef_mul[] };84; CHECK-NEXT:            new: [Start] -> { Stmt_body[i0, i1] -> MemRef_A[i0] : i0 <= i1 <= 3 - Start; Stmt_body[i0, 0] -> MemRef_A[i0] : i0 <= -4 + Start; Stmt_body[1, 0] -> MemRef_A[1] : Start <= 4 }85; CHECK-NEXT:             ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]86; CHECK-NEXT:                 [Start] -> { Stmt_body[i0, i1] -> MemRef_phi[] };87; CHECK-NEXT:            new: [Start] -> { Stmt_body[i0, i1] -> MemRef_A[i0] : i0 <= i1 <= 3 - Start; Stmt_body[1, 0] -> MemRef_A[1]; Stmt_body[0, 0] -> MemRef_A[0] : Start >= 4 };88; CHECK-NEXT:     Stmt_reduction_inc89; CHECK-NEXT:             ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]90; CHECK-NEXT:                 [Start] -> { Stmt_reduction_inc[i0, i1] -> MemRef_mul[] };91; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : i0 <= i1 <= 3 - Start; Stmt_reduction_inc[1, 0] -> MemRef_A[1]; Stmt_reduction_inc[0, 0] -> MemRef_A[0] : Start >= 4 };92; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]93; CHECK-NEXT:                 [Start] -> { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };94; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 0 < i1 <= 3 - Start; Stmt_reduction_inc[i0, 0] -> MemRef_A[i0] }95; CHECK-NEXT:     Stmt_reduction_exit96; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]97; CHECK-NEXT:                 [Start] -> { Stmt_reduction_exit[i0] -> MemRef_A[i0] };98; CHECK-NEXT:             ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]99; CHECK-NEXT:                 [Start] -> { Stmt_reduction_exit[i0] -> MemRef_mul[] };100; CHECK-NEXT:            new: [Start] -> { Stmt_reduction_exit[i0] -> MemRef_A[i0] };101; CHECK-NEXT: }102