brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 6460dbd Raw
79 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<delicm>' -polly-print-delicm -disable-output < %s | FileCheck %s2;3;    void func(double *A) {4;      for (int j = 0; j < 2; j += 1) { /* outer */5;        fsomeval = 21.0 + 21.0;6;        double phi = 0.0;7;        for (int i = 0; i < 4; i += 1) /* reduction */8;          phi += 4.2;9;        A[j] = fsomeval;10;      }11;      g(fsomeval);12;    }13;14; Check that fsomeval is not mapped to A[j] because it is escaping the SCoP.15; Supporting this would require reloading the scalar from A[j], and/or16; identifying the last instance of fsomeval that escapes.17;18define void @func(ptr noalias nonnull %A) {19entry:20  br label %outer.preheader21 22outer.preheader:23  br label %outer.for24 25outer.for:26  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]27  %j.cmp = icmp slt i32 %j, 228  %fsomeval = fadd double 21.0, 21.029  br i1 %j.cmp, label %reduction.preheader, label %outer.exit30 31 32    reduction.preheader:33      br label %reduction.for34 35    reduction.for:36      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]37      %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]38      %i.cmp = icmp slt i32 %i, 439      br i1 %i.cmp, label %body, label %reduction.exit40 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      br label %reduction.for52 53    reduction.exit:54      %A_idx = getelementptr inbounds double, ptr %A, i32 %j55      store double %fsomeval, ptr %A_idx56      br label %outer.inc57 58 59 60outer.inc:61  %j.inc = add nuw nsw i32 %j, 162  br label %outer.for63 64outer.exit:65  br label %return66 67return:68  call void @g(double %fsomeval)69  ret void70}71 72declare void @g(double)73 74 75; CHECK: Statistics {76; CHECK:     Compatible overwrites: 177; CHECK: }78; CHECK: No modification has been made79