54 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<import-jscop;simplify-0>' -polly-print-simplify -polly-import-jscop-postfix=transformed -disable-output < %s | FileCheck -match-full-lines %s2;3; Do not combine stores if there is a read between them.4; Note: The read between is unused, so will be removed by markAndSweep.5; However, searches for coalesces takes place before.6;7; for (int j = 0; j < n; j += 1) {8; A[0] = 42.0;9; tmp = A[0];10; A[0] = 42.0;11; }12;13define void @nocoalesce_readbetween(i32 %n, ptr noalias nonnull %A) {14entry:15 br label %for16 17for:18 %j = phi i32 [0, %entry], [%j.inc, %inc]19 %j.cmp = icmp slt i32 %j, %n20 br i1 %j.cmp, label %body, label %exit21 22 body:23 store double 42.0, ptr %A24 %tmp = load double, ptr %A25 store double 42.0, ptr %A26 br label %inc27 28inc:29 %j.inc = add nuw nsw i32 %j, 130 br label %for31 32exit:33 br label %return34 35return:36 ret void37}38 39 40; CHECK: Statistics {41; CHECK: Overwrites removed: 042; CHECK: Partial writes coalesced: 043; CHECK: }44 45; CHECK: After accesses {46; CHECK-NEXT: Stmt_body47; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]48; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };49; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 >= 17 };50; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]51; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };52; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 <= 16 };53; CHECK-NEXT: }54