58 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output -polly-allow-nonaffine < %s | FileCheck %s2;3; Verify if two independent reductions in same loop is detected4;5; CHECK: Stmt_for_body6; CHECK: Reduction Type: +7; CHECK-NEXT: MemRef_sum1[0]8; CHECK-NEXT: Reduction Type: +9; CHECK-NEXT: MemRef_sum1[0]10;11; CHECK: Stmt_for_body_b12; CHECK: Reduction Type: +13; CHECK-NEXT: MemRef_sum2[0]14; CHECK-NEXT: Reduction Type: +15; CHECK-NEXT: MemRef_sum2[0]16;17; int red(int *A, int *B, int *sum, int * prod, int n) {18; for (int i = 0; i < n; ++i) {19; *sum += A[i];20; *prod += B[i];21; }22; }23 24target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"25target triple = "aarch64-unknown-linux-gnu"26 27; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable28define dso_local i32 @red(ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %B, ptr nocapture noundef %sum1, ptr nocapture noundef %sum2, i32 noundef %n) local_unnamed_addr #0 {29entry:30 %cmp7 = icmp sgt i32 %n, 031 br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup32 33for.body.preheader: ; preds = %entry34 %wide.trip.count = zext nneg i32 %n to i6435 br label %for.body36 37for.cond.cleanup: ; preds = %for.body, %entry38 ret i32 undef39 40for.body: ; preds = %for.body.preheader, %for.body41 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]42 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv43 %0 = load i32, ptr %arrayidx44 %1 = load i32, ptr %sum145 %add = add nsw i32 %1, %046 store i32 %add, ptr %sum147 %arrayidx2 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv48 %2 = load i32, ptr %arrayidx249 %3 = load i32, ptr %sum250 %add3 = add nsw i32 %3, %251 store i32 %add3, ptr %sum252 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 153 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count54 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body55}56 57 58