53 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output -polly-allow-nonaffine < %s | FileCheck %s2;3; Verify if reduction spread across multiple blocks in a single scop statement are detected4;5; CHECK: Stmt_for_body6; CHECK: Reduction Type: +7; CHECK-NEXT: MemRef_sum[0]8; CHECK: Reduction Type: +9; CHECK-NEXT: MemRef_sum[0]10;11; void f(int*__restrict A, int*__restrict B, int *sum) {12; for (int i = 0; i < 4444; ++i) {13; if (B[i])14; *sum += A[i];15; }16; }17 18target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"19target triple = "aarch64-unknown-linux-gnu"20 21; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable22define dso_local void @f(ptr noalias nocapture noundef readonly %A, ptr noalias nocapture noundef readonly %B, ptr nocapture noundef %sum) local_unnamed_addr #0 {23entry:24 br label %entry.split25 26entry.split: ; preds = %entry27 br label %for.body28 29for.cond.cleanup: ; preds = %for.inc30 ret void31 32for.body: ; preds = %entry.split, %for.inc33 %indvars.iv = phi i64 [ 0, %entry.split ], [ %indvars.iv.next, %for.inc ]34 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv35 %0 = load i32, ptr %arrayidx36 %tobool.not = icmp eq i32 %0, 037 br i1 %tobool.not, label %for.inc, label %if.then38 39if.then: ; preds = %for.body40 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv41 %1 = load i32, ptr %arrayidx242 %2 = load i32, ptr %sum43 %add = add nsw i32 %2, %144 store i32 %add, ptr %sum45 br label %for.inc46 47for.inc: ; preds = %for.body, %if.then48 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 149 %exitcond.not = icmp eq i64 %indvars.iv.next, 444450 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body51}52 53