brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 627a445 Raw
81 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<flatten;delicm>' -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s2;3; Verify that delicm can cope with never taken PHI incoming edges.4; The edge %body -> %body_phi is never taken, hence the access MemoryKind::PHI,5; WRITE in %body for %phi is never used.6; When mapping %phi, the write's access relation is the empty set.7;8;    void func(double *A) {9;      for (int j = 0; j < 2; j += 1) { /* outer */10;        for (int i = 0; i < 4; i += 1) { /* reduction */11;          double phi = 21.0;12;          if (j < 10) // Tautology, since 0<=j<213;            phi = 42.0;14;        }15;        A[j] = phi;16;      }17;    }18;19define void @func(ptr noalias nonnull %A, ptr noalias nonnull %dummy) {20entry:21  br label %outer.preheader22 23outer.preheader:24  br label %outer.for25 26outer.for:27  %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]28  %j.cmp = icmp slt i32 %j, 229  br i1 %j.cmp, label %reduction.preheader, label %outer.exit30 31 32    reduction.preheader:33      %A_idx = getelementptr inbounds double, ptr %A, i32 %j34      br label %reduction.for35 36    reduction.for:37      %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]38      br label %body39 40 41 42        body:43          %cond = icmp slt i32 %j, 1044          br i1 %cond, label %alwaystaken, label %body_phi45 46        alwaystaken:47          store double 0.0, ptr %dummy48          br label %body_phi49 50        body_phi:51          %phi = phi double [21.0, %body], [42.0, %alwaystaken]52          br label %reduction.inc53 54 55 56    reduction.inc:57      %i.inc = add nuw nsw i32 %i, 158      %i.cmp = icmp slt i32 %i.inc, 459      br i1 %i.cmp, label %reduction.for, label %reduction.exit60 61    reduction.exit:62      store double %phi, ptr %A_idx63      br label %outer.inc64 65 66outer.inc:67  %j.inc = add nuw nsw i32 %j, 168  br label %outer.for69 70outer.exit:71  br label %return72 73return:74  ret void75}76 77 78; CHECK: Statistics {79; CHECK:     PHI scalars mapped:    180; CHECK: }81