[polly] r214491 - [Fix] Annotate the IslAst with broken reductions (Missing files)

Johannes Doerfert jdoerfert at codeaurora.org
Fri Aug 1 01:20:26 PDT 2014


Author: jdoerfert
Date: Fri Aug  1 03:20:26 2014
New Revision: 214491

URL: http://llvm.org/viewvc/llvm-project?rev=214491&view=rev
Log:
[Fix] Annotate the IslAst with broken reductions (Missing files)

  + test cases of r214489.

Added:
    polly/trunk/test/Isl/Ast/reduction_clauses_multidimensional_access.ll
    polly/trunk/test/Isl/Ast/reduction_clauses_onedimensional_access.ll
    polly/trunk/test/Isl/Ast/reduction_different_reduction_clauses.ll

Added: polly/trunk/test/Isl/Ast/reduction_clauses_multidimensional_access.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/reduction_clauses_multidimensional_access.ll?rev=214491&view=auto
==============================================================================
--- polly/trunk/test/Isl/Ast/reduction_clauses_multidimensional_access.ll (added)
+++ polly/trunk/test/Isl/Ast/reduction_clauses_multidimensional_access.ll Fri Aug  1 03:20:26 2014
@@ -0,0 +1,68 @@
+; RUN: opt %loadPolly -polly-delinearize -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
+;
+; CHECK: #pragma omp parallel for reduction (^ : sum)
+;        void f(int N, int M, int P, int sum[P][M]) {
+;          for (int i = 0; i < N; i++)
+;            for (int j = 0; j < P; j++)
+; CHECK:       #pragma simd
+;              for (int k = 0; k < M; k++)
+;                sum[j][k] ^= j;
+;        }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @f(i32 %N, i32 %M, i32 %P, i32* %sum) {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc11, %entry
+  %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
+  %cmp = icmp slt i32 %i.0, %N
+  br i1 %cmp, label %for.body, label %for.end13
+
+for.body:                                         ; preds = %for.cond
+  br label %for.cond1
+
+for.cond1:                                        ; preds = %for.inc8, %for.body
+  %j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
+  %cmp2 = icmp slt i32 %j.0, %P
+  br i1 %cmp2, label %for.body3, label %for.end10
+
+for.body3:                                        ; preds = %for.cond1
+  br label %for.cond4
+
+for.cond4:                                        ; preds = %for.inc, %for.body3
+  %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
+  %cmp5 = icmp slt i32 %k.0, %M
+  br i1 %cmp5, label %for.body6, label %for.end
+
+for.body6:                                        ; preds = %for.cond4
+  %tmp = mul nsw i32 %j.0, %M
+  %arrayidx.sum = add i32 %tmp, %k.0
+  %arrayidx7 = getelementptr inbounds i32* %sum, i32 %arrayidx.sum
+  %tmp1 = load i32* %arrayidx7, align 4
+  %xor = xor i32 %tmp1, %j.0
+  store i32 %xor, i32* %arrayidx7, align 4
+  br label %for.inc
+
+for.inc:                                          ; preds = %for.body6
+  %inc = add nsw i32 %k.0, 1
+  br label %for.cond4
+
+for.end:                                          ; preds = %for.cond4
+  br label %for.inc8
+
+for.inc8:                                         ; preds = %for.end
+  %inc9 = add nsw i32 %j.0, 1
+  br label %for.cond1
+
+for.end10:                                        ; preds = %for.cond1
+  br label %for.inc11
+
+for.inc11:                                        ; preds = %for.end10
+  %inc12 = add nsw i32 %i.0, 1
+  br label %for.cond
+
+for.end13:                                        ; preds = %for.cond
+  ret void
+}

Added: polly/trunk/test/Isl/Ast/reduction_clauses_onedimensional_access.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/reduction_clauses_onedimensional_access.ll?rev=214491&view=auto
==============================================================================
--- polly/trunk/test/Isl/Ast/reduction_clauses_onedimensional_access.ll (added)
+++ polly/trunk/test/Isl/Ast/reduction_clauses_onedimensional_access.ll Fri Aug  1 03:20:26 2014
@@ -0,0 +1,50 @@
+; RUN: opt %loadPolly -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
+;
+; CHECK: #pragma omp parallel for reduction (^ : sum)
+;        void f(int N, int M, int *sum) {
+;          for (int i = 0; i < N; i++)
+; CHECK:    #pragma simd
+;            for (int j = 0; j < M; j++)
+;              sum[j] ^= j;
+;        }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @f(i32 %N, i32 %M, i32* %sum) {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc4, %entry
+  %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ]
+  %cmp = icmp slt i32 %i.0, %N
+  br i1 %cmp, label %for.body, label %for.end6
+
+for.body:                                         ; preds = %for.cond
+  br label %for.cond1
+
+for.cond1:                                        ; preds = %for.inc, %for.body
+  %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
+  %cmp2 = icmp slt i32 %j.0, %M
+  br i1 %cmp2, label %for.body3, label %for.end
+
+for.body3:                                        ; preds = %for.cond1
+  %arrayidx = getelementptr inbounds i32* %sum, i32 %j.0
+  %tmp = load i32* %arrayidx, align 4
+  %xor = xor i32 %tmp, %j.0
+  store i32 %xor, i32* %arrayidx, align 4
+  br label %for.inc
+
+for.inc:                                          ; preds = %for.body3
+  %inc = add nsw i32 %j.0, 1
+  br label %for.cond1
+
+for.end:                                          ; preds = %for.cond1
+  br label %for.inc4
+
+for.inc4:                                         ; preds = %for.end
+  %inc5 = add nsw i32 %i.0, 1
+  br label %for.cond
+
+for.end6:                                         ; preds = %for.cond
+  ret void
+}

Added: polly/trunk/test/Isl/Ast/reduction_different_reduction_clauses.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/reduction_different_reduction_clauses.ll?rev=214491&view=auto
==============================================================================
--- polly/trunk/test/Isl/Ast/reduction_different_reduction_clauses.ll (added)
+++ polly/trunk/test/Isl/Ast/reduction_different_reduction_clauses.ll Fri Aug  1 03:20:26 2014
@@ -0,0 +1,55 @@
+; RUN: opt %loadPolly -basicaa -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
+;
+; CHECK: #pragma simd reduction (+ : sum{{[1,2]}}, sum{{[1,2]}}) reduction (* : prod) reduction (| : or) reduction (& : and)
+; CHECK: #pragma omp parallel for reduction (+ : sum{{[1,2]}}, sum{{[1,2]}}) reduction (* : prod) reduction (| : or) reduction (& : and)
+; CHECK: for (int c1 = 0; c1 < N; c1 += 1)
+; CHECK:   Stmt_for_body(c1);
+;
+;    void f(int N, int *restrict sum1, int *restrict sum2, int *restrict prod,
+;           int *restrict and, int *restrict or ) {
+;      for (int i = 0; i < N; i++) {
+;        *sum1 += i;
+;        *sum2 += i + 1;
+;        *prod *= i;
+;        *and &= i;
+;        * or |= i;
+;      }
+;    }
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f(i32 %N, i32* noalias %sum1, i32* noalias %sum2, i32* noalias %prod, i32* noalias %and, i32* noalias %or) {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.inc, %entry
+  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+  %cmp = icmp slt i32 %i.0, %N
+  br i1 %cmp, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond
+  %tmp = load i32* %sum1, align 4
+  %add = add nsw i32 %tmp, %i.0
+  store i32 %add, i32* %sum1, align 4
+  %add1 = add nsw i32 %i.0, 1
+  %tmp1 = load i32* %sum2, align 4
+  %add2 = add nsw i32 %tmp1, %add1
+  store i32 %add2, i32* %sum2, align 4
+  %tmp2 = load i32* %prod, align 4
+  %mul = mul nsw i32 %tmp2, %i.0
+  store i32 %mul, i32* %prod, align 4
+  %tmp3 = load i32* %and, align 4
+  %and3 = and i32 %tmp3, %i.0
+  store i32 %and3, i32* %and, align 4
+  %tmp4 = load i32* %or, align 4
+  %or4 = or i32 %tmp4, %i.0
+  store i32 %or4, i32* %or, align 4
+  br label %for.inc
+
+for.inc:                                          ; preds = %for.body
+  %inc = add nsw i32 %i.0, 1
+  br label %for.cond
+
+for.end:                                          ; preds = %for.cond
+  ret void
+}





More information about the llvm-commits mailing list