1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
; ModuleID = 'simple_nested_loop.s'
; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-openmp -S %s | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"
@A = common global [10 x double] zeroinitializer, align 4
@B = common global [10 x double] zeroinitializer, align 4
define void @loop_openmp() nounwind {
entry:
br label %for.cond
for.cond: ; preds = %for.inc10, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc10 ]
%exitcond1 = icmp ne i32 %i.0, 10
br i1 %exitcond1, label %for.body, label %for.end13
for.body: ; preds = %for.cond
br label %for.cond2
for.cond2: ; preds = %for.inc, %for.body
%tmp = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%arrayidx = getelementptr [10 x double]* @A, i32 0, i32 %tmp
%exitcond = icmp ne i32 %tmp, 10
br i1 %exitcond, label %for.body5, label %for.end
for.body5: ; preds = %for.cond2
%conv = sitofp i32 %tmp to double
%tmp8 = load double* %arrayidx, align 4
%add = fadd double %tmp8, %conv
store double %add, double* %arrayidx, align 4
br label %for.inc
for.inc: ; preds = %for.body5
%inc = add nsw i32 %tmp, 1
br label %for.cond2
for.end: ; preds = %for.cond2
br label %for.inc10
for.inc10: ; preds = %for.end
%inc12 = add nsw i32 %i.0, 1
br label %for.cond
for.end13: ; preds = %for.cond
ret void
}
define i32 @main() nounwind {
entry:
call void @llvm.memset.p0i8.i32(i8* bitcast ([10 x double]* @A to i8*), i8 0, i32 40, i32 4, i1 false)
call void @loop_openmp()
ret i32 0
}
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
; CHECK: %omp.userContext = alloca %loop_openmp.omp_subfn.omp.userContext
; CHECK: getelementptr inbounds %loop_openmp.omp_subfn.omp.userContext* %omp.userContext
; CHECK: %omp_data = bitcast %loop_openmp.omp_subfn.omp.userContext* %omp.userContext to i8*
; CHECK: @GOMP_parallel_loop_runtime_start(void (i8*)* @loop_openmp.omp_subfn, i8* %omp_data
; CHECK: call void @loop_openmp.omp_subfn(i8* %omp_data)
; CHECK: %omp.userContext1 = bitcast i8* %omp.userContext to %loop_openmp.omp_subfn.omp.userContext*
|