51 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output -polly-allow-nonaffine < %s | FileCheck %s2;3; Validate that the accesses to INDICES[i] is not part of a reduction.4;5; CHECK: Reduction Type: NONE6; CHECK: MemRef_INDICES[i0]7; CHECK: Reduction Type: +8; CHECK: MemRef_A[o0]9; CHECK: Reduction Type: +10; CHECK: MemRef_A[o0]11; CHECK: Reduction Type: NONE12; CHECK: MemRef_INDICES[i0]13;14; void f(double *restrict A, int *restrict INDICES, int N) {15; for (int i = 0; i < N; i++) {16; A[INDICES[i]] += N;17; INDICES[i] += N;18; }19; }20;21target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"22 23define void @f(double* noalias %A, i32* noalias %INDICES, i32 %N) {24entry:25 br label %for.cond26 27for.cond: ; preds = %for.inc, %entry28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]29 %cmp = icmp slt i32 %i.0, %N30 br i1 %cmp, label %for.body, label %for.end31 32for.body: ; preds = %for.cond33 %conv = sitofp i32 %N to double34 %arrayidx = getelementptr inbounds i32, i32* %INDICES, i32 %i.035 %tmp = load i32, i32* %arrayidx, align 436 %arrayidx1 = getelementptr inbounds double, double* %A, i32 %tmp37 %tmp1 = load double, double* %arrayidx1, align 838 %add = fadd fast double %tmp1, %conv39 store double %add, double* %arrayidx1, align 840 %add3 = add nsw i32 %tmp, %N41 store i32 %add3, i32* %arrayidx, align 442 br label %for.inc43 44for.inc: ; preds = %for.body45 %inc = add nsw i32 %i.0, 146 br label %for.cond47 48for.end: ; preds = %for.cond49 ret void50}51