• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-parallel -polly-parallel-force -polly-ast -analyze < %s | FileCheck %s -check-prefix=AST
2; RUN: opt %loadPolly -polly-parallel -polly-parallel-force -polly-codegen -S -verify-dom-info < %s | FileCheck %s -check-prefix=IR
3
4; This code has failed the scev based code generation as the scev in the scop
5; contains an AddRecExpr of an outer loop. When generating code, we did not
6; properly forward the value of this expression to the subfunction.
7
8; AST: #pragma omp parallel for
9; AST: for (int c0 = 0; c0 <= 1023; c0 += 1)
10; AST:  Stmt_for_j(c0);
11
12; IR: @single_parallel_loop_polly_subfn
13
14target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
15
16@A = common global [1024 x float] zeroinitializer, align 16
17
18define void @single_parallel_loop() nounwind {
19entry:
20  br label %for.i
21
22for.i:
23  %indvar.i = phi i64 [ %indvar.i.next, %for.i.inc], [ 0, %entry ]
24  br label %for.j
25
26for.j:
27  %indvar.j = phi i64 [ %indvar.j.next, %for.j], [ 0, %for.i ]
28  %sum = add i64 %indvar.j, %indvar.i
29  %scevgep = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %sum
30  store float 0.0, float *%scevgep
31  %indvar.j.next = add i64 %indvar.j, 1
32  %exitcond.j = icmp slt i64 %indvar.j.next, 1024
33  br i1 %exitcond.j, label %for.j, label %for.i.inc
34
35for.i.inc:
36  fence seq_cst
37  %indvar.i.next = add i64 %indvar.i, 1
38  %exitcond.i = icmp ne i64 %indvar.i.next, 1024
39  br i1 %exitcond.i, label %for.i, label %exit
40
41exit:
42  ret void
43}
44