85 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; double phi = 0.0;6; for (int i = 0; i < 4; i += 1) /* reduction */7; phi += 4.2;8; if (phi < 0.0)9; A[j] = undef;10; A[j] = phi;11; }12; }13;14; The MAY_WRITE in reduction.exit.true avoids that anything can be mapped to15; A[j] because it would be overwritten by that MAY_WRITE just before the final16; MUST_WRITE. Also nothing can be map to the MAY_WRITE itself because it is a17; MAY_WRITE.18;19define void @func(ptr noalias nonnull %A) {20entry:21 %fsomeval = fadd double 21.0, 21.022 br label %outer.preheader23 24outer.preheader:25 br label %outer.for26 27outer.for:28 %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]29 %j.cmp = icmp slt i32 %j, 230 br i1 %j.cmp, label %reduction.preheader, label %outer.exit31 32 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 %i.cmp = icmp slt i32 %i, 440 br i1 %i.cmp, label %body, label %reduction.exit41 42 43 44 body:45 %add = fadd double %phi, 4.246 br label %reduction.inc47 48 49 50 reduction.inc:51 %i.inc = add nuw nsw i32 %i, 152 br label %reduction.for53 54 reduction.exit:55 %A_idx = getelementptr inbounds double, ptr %A, i32 %j56 %phi.cmp = fcmp ogt double %phi, 0.057 br i1 %phi.cmp, label %reduction.exit.true, label %reduction.exit.unconditional58 59 reduction.exit.true:60 store double undef, ptr %A_idx61 br label %reduction.exit.unconditional62 63 reduction.exit.unconditional:64 store double %phi, ptr %A_idx65 br label %outer.inc66 67 68 69outer.inc:70 %j.inc = add nuw nsw i32 %j, 171 br label %outer.for72 73outer.exit:74 br label %return75 76return:77 ret void78}79 80 81; CHECK: Statistics {82; CHECK: Compatible overwrites: 183; CHECK: }84; CHECK: No modification has been made85