39 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2; Verify if the following case is not detected as reduction.3;4; void f(int *A,int *sum) {5; for (int i = 0; i < 1024; i++)6; sum[0] = sum[1] + A[i];7; }8;9; Verify that we don't detect the reduction on sum10;11; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]12; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_sum[1] };13; CHECK-NEXT:ReadAccess := [Reduction Type: NONE] [Scalar: 0]14; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[i0] };15; CHECK-NEXT:MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]16; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_sum[0] };17;18target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"19 20define dso_local void @f(ptr nocapture noundef readonly %A, ptr nocapture noundef %sum) local_unnamed_addr #0 {21entry:22 br label %for.body23 24for.cond.cleanup: ; preds = %for.body25 ret void26 27for.body: ; preds = %entry.split, %for.body28 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]29 %arrayidx = getelementptr inbounds i32, ptr %sum, i64 130 %0 = load i32, ptr %arrayidx31 %arrayidx1 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv32 %1 = load i32, ptr %arrayidx133 %add = add nsw i32 %1, %034 store i32 %add, ptr %sum35 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 136 %exitcond.not = icmp eq i64 %indvars.iv.next, 102437 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body38}39