• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-parallel \
2; RUN: -polly-parallel-force -polly-codegen \
3; RUN: -S -verify-dom-info < %s \
4; RUN: | FileCheck %s -check-prefix=IR
5
6; RUN: opt %loadPolly -polly-parallel \
7; RUN: -polly-parallel-force -polly-codegen -polly-omp-backend=LLVM \
8; RUN: -S -verify-dom-info < %s \
9; RUN: | FileCheck %s -check-prefix=LIBOMP-IR
10
11; RUN: opt %loadPolly -polly-parallel \
12; RUN: -polly-parallel-force -polly-codegen -polly-omp-backend=LLVM \
13; RUN: -polly-scheduling=static \
14; RUN: -S -verify-dom-info < %s \
15; RUN: | FileCheck %s -check-prefix=LIBOMP-STATIC-IR
16
17; Ensure the scalars are initialized before the OpenMP code is launched.
18;
19; #define N 1024
20; float A[N];
21;
22; void single_parallel_loop(float alpha) {
23;   for (long i = 0; i < N; i++)
24;     A[i] = alpha;
25; }
26;
27
28; IR-LABEL: polly.start:
29; IR-NEXT:    store float %alpha, float* %alpha.s2a
30
31; IR: GOMP_parallel_loop_runtime_start
32
33; LIBOMP-IR-LABEL: polly.start:
34; LIBOMP-IR-NEXT:    store float %alpha, float* %alpha.s2a
35
36; LIBOMP-IR: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call
37; LIBOMP-IR: call void @__kmpc_dispatch_init_{{[4|8]}}
38
39; LIBOMP-STATIC-IR: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call
40; LIBOMP-STATIC-IR: call void @__kmpc_for_static_init_{{[4|8]}}
41
42target 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"
43
44@A = common global [1024 x float] zeroinitializer, align 16
45
46define void @single_parallel_loop(float %alpha) nounwind {
47entry:
48  br label %for.i
49
50for.i:
51  %indvar = phi i64 [ %indvar.next, %for.inc], [ 0, %entry ]
52  %scevgep = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar
53  %exitcond = icmp ne i64 %indvar, 1024
54  br i1 %exitcond, label %S, label %exit
55
56S:
57  %alphaplus = fadd float 1.0, %alpha
58  store float %alphaplus, float* %scevgep
59  br label %for.inc
60
61for.inc:
62  %indvar.next = add i64 %indvar, 1
63  br label %for.i
64
65exit:
66  ret void
67}
68