• 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 < %s | FileCheck %s -check-prefix=IR
3
4; Make sure we correctly forward the reference to 'A' to the OpenMP subfunction.
5;
6; void loop_references_outer_ids(float *A) {
7;   for (long i = 0; i < 100; i++)
8;     A[i] = i;
9; }
10
11
12; AST: #pragma simd
13; AST: #pragma omp parallel for
14; AST: for (int c0 = 0; c0 <= 99; c0 += 1)
15; AST:   Stmt_for_body(c0);
16
17; IR-LABEL: polly.parallel.for:
18; IR-NEXT:  %polly.subfn.storeaddr.A = getelementptr inbounds { float* }, { float* }* %polly.par.userContext, i32 0, i32 0
19; IR-NEXT:  store float* %A, float** %polly.subfn.storeaddr.A
20; IR-NEXT:  %polly.par.userContext1 = bitcast { float* }* %polly.par.userContext to i8*
21
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define void @loop_references_outer_ids(float* %A) {
25entry:
26  br label %for.cond
27
28for.cond:                                         ; preds = %for.inc, %entry
29  %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
30  %exitcond = icmp ne i64 %i.0, 100
31  br i1 %exitcond, label %for.body, label %for.end
32
33for.body:                                         ; preds = %for.cond
34  %conv = sitofp i64 %i.0 to float
35  %arrayidx = getelementptr inbounds float, float* %A, i64 %i.0
36  store float %conv, float* %arrayidx, align 4
37  br label %for.inc
38
39for.inc:                                          ; preds = %for.body
40  %inc = add nsw i64 %i.0, 1
41  br label %for.cond
42
43for.end:                                          ; preds = %for.cond
44  ret void
45}
46