ThreeLevel.ll 10.2 KB
Newer Older
Akash Kothari's avatar
Akash Kothari committed
1
2
3
; RUN: opt -load LLVMBuildDFG.so -load LLVMDFG2LLVM_CPU.so -load LLVMClearDFG.so -S -dfg2llvm-cpu -clearDFG <  %s | FileCheck %s
; ModuleID = 'ThreeLevel.ll'
source_filename = "ThreeLevel.c"
Akash Kothari's avatar
Akash Kothari committed
4
5
6
7
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Root = type { i32*, i64, i32*, i64, i32*, i64 }
Akash Kothari's avatar
Akash Kothari committed
8
9
10
11
%struct.out.Func1 = type <{ i32* }>
%struct.out.Func3 = type <{ i32* }>
%struct.out.Func2 = type <{ i32* }>
%struct.out.PipeRoot = type <{ i32* }>
Akash Kothari's avatar
Akash Kothari committed
12
13


Akash Kothari's avatar
Akash Kothari committed
14
15
16
17
18
; CHECK-LABEL: i32 @main(
; CHECK-NOT: call void @llvm.hpvm.init()
; CHECK: call i8* @llvm_hpvm_cpu_launch(i8* (i8*)* @LaunchDataflowGraph, i8*
; CHECK-NOT: call i8* @llvm.hpvm.launch(i8*
; CHECK: call void @llvm_hpvm_cpu_wait(i8*
Akash Kothari's avatar
Akash Kothari committed
19

Akash Kothari's avatar
Akash Kothari committed
20
21
; CHECK-LABEL: @Func1_cloned.1_cloned_cloned_cloned_cloned_cloned_cloned
; CHECK: call i8* @llvm_hpvm_cpu_argument_ptr(
Akash Kothari's avatar
Akash Kothari committed
22

Akash Kothari's avatar
Akash Kothari committed
23
24
25
26
27
28
; CHECK-LABEL: @Func3_cloned.2_cloned_cloned_cloned_cloned_cloned_cloned(
; CHECK-LABEL: for.body1:
; CHECK: %index.y = phi i64 [ 0, %for.body ], [ %index.y.inc, %for.body1 ]
; CHECK-NEXT: call void @llvm_hpvm_cpu_dstack_push(
; CHECK-NEXT: @Func1_cloned.1_cloned_cloned_cloned_cloned_cloned_cloned(
; CHECK-NEXT: call void @llvm_hpvm_cpu_dstack_pop()
Akash Kothari's avatar
Akash Kothari committed
29

Akash Kothari's avatar
Akash Kothari committed
30
31
32
33
34
35
; CHECK-LABEL: @Func2_cloned.3_cloned_cloned_cloned_cloned_cloned_cloned(
; CHECK-LABEL: for.body:
; CHECK-NEXT: %index.x = phi i64 [ 0, %entry ], [ %index.x.inc, %for.body ]
; CHECK-NEXT: call void @llvm_hpvm_cpu_dstack_push(
; CHECK-NEXT: @Func3_cloned.2_cloned_cloned_cloned_cloned_cloned_cloned(
; CHECK-NEXT: call void @llvm_hpvm_cpu_dstack_pop()
Akash Kothari's avatar
Akash Kothari committed
36

Akash Kothari's avatar
Akash Kothari committed
37
38
39
40
41
42
43
; CHECK-LABEL: @PipeRoot_cloned.4(
; CHECK: call void @llvm_hpvm_cpu_dstack_push(
; CHECK-NEXT: @Func2_cloned.3_cloned_cloned_cloned_cloned_cloned_cloned(
; CHECK-NEXT: call void @llvm_hpvm_cpu_dstack_pop()

; CHECK-LABEL: @LaunchDataflowGraph(
; CHECK: call %struct.out.PipeRoot @PipeRoot_cloned.4(
Akash Kothari's avatar
Akash Kothari committed
44

Akash Kothari's avatar
Akash Kothari committed
45
declare dso_local void @__hpvm__hint(i32) local_unnamed_addr #0
Akash Kothari's avatar
Akash Kothari committed
46

Akash Kothari's avatar
Akash Kothari committed
47
declare dso_local void @__hpvm__attributes(i32, ...) local_unnamed_addr #0
Akash Kothari's avatar
Akash Kothari committed
48

Akash Kothari's avatar
Akash Kothari committed
49
declare dso_local void @__hpvm__return(i32, ...) local_unnamed_addr #0
Akash Kothari's avatar
Akash Kothari committed
50
51

; Function Attrs: argmemonly nounwind
Akash Kothari's avatar
Akash Kothari committed
52
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
Akash Kothari's avatar
Akash Kothari committed
53

Akash Kothari's avatar
Akash Kothari committed
54
55
56
57
58
59
60
61
declare dso_local i8* @__hpvm__createNodeND(i32, ...) local_unnamed_addr #0

declare dso_local void @__hpvm__bindIn(i8*, i32, i32, i32) local_unnamed_addr #0

declare dso_local void @__hpvm__bindOut(i8*, i32, i32, i32) local_unnamed_addr #0

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
Akash Kothari's avatar
Akash Kothari committed
62
63

; Function Attrs: nounwind uwtable
Akash Kothari's avatar
Akash Kothari committed
64
define dso_local i32 @main() local_unnamed_addr #2 {
Akash Kothari's avatar
Akash Kothari committed
65
66
67
68
69
70
71
entry:
  %In1 = alloca i32, align 4
  %In2 = alloca i32, align 4
  %Out = alloca i32, align 4
  %RootArgs = alloca %struct.Root, align 8
  %0 = bitcast i32* %In1 to i8*
  call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0) #3
Akash Kothari's avatar
Akash Kothari committed
72
  store i32 1, i32* %In1, align 4, !tbaa !6
Akash Kothari's avatar
Akash Kothari committed
73
74
  %1 = bitcast i32* %In2 to i8*
  call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %1) #3
Akash Kothari's avatar
Akash Kothari committed
75
  store i32 2, i32* %In2, align 4, !tbaa !6
Akash Kothari's avatar
Akash Kothari committed
76
77
  %2 = bitcast i32* %Out to i8*
  call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #3
Akash Kothari's avatar
Akash Kothari committed
78
  store i32 0, i32* %Out, align 4, !tbaa !6
Akash Kothari's avatar
Akash Kothari committed
79
80
81
  %3 = bitcast %struct.Root* %RootArgs to i8*
  call void @llvm.lifetime.start.p0i8(i64 48, i8* nonnull %3) #3
  %input1 = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 0
Akash Kothari's avatar
Akash Kothari committed
82
  store i32* %In1, i32** %input1, align 8, !tbaa !10
Akash Kothari's avatar
Akash Kothari committed
83
  %Insize1 = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 1
Akash Kothari's avatar
Akash Kothari committed
84
  store i64 32, i64* %Insize1, align 8, !tbaa !14
Akash Kothari's avatar
Akash Kothari committed
85
  %input2 = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 2
Akash Kothari's avatar
Akash Kothari committed
86
  store i32* %In2, i32** %input2, align 8, !tbaa !15
Akash Kothari's avatar
Akash Kothari committed
87
  %Insize2 = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 3
Akash Kothari's avatar
Akash Kothari committed
88
  store i64 32, i64* %Insize2, align 8, !tbaa !16
Akash Kothari's avatar
Akash Kothari committed
89
  %output = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 4
Akash Kothari's avatar
Akash Kothari committed
90
  store i32* %Out, i32** %output, align 8, !tbaa !17
Akash Kothari's avatar
Akash Kothari committed
91
  %Outsize = getelementptr inbounds %struct.Root, %struct.Root* %RootArgs, i64 0, i32 5
Akash Kothari's avatar
Akash Kothari committed
92
93
94
95
96
97
  store i64 32, i64* %Outsize, align 8, !tbaa !18
  call void @llvm.hpvm.init()
  %4 = bitcast %struct.Root* %RootArgs to i8*
  %graphID = call i8* @llvm.hpvm.launch(i8* bitcast (%struct.out.PipeRoot (i32*, i64, i32*, i64, i32*, i64)* @PipeRoot_cloned to i8*), i8* %4, i1 false)
  call void @llvm.hpvm.wait(i8* %graphID)
  call void @llvm.hpvm.cleanup()
Akash Kothari's avatar
Akash Kothari committed
98
99
100
101
102
103
104
  call void @llvm.lifetime.end.p0i8(i64 48, i8* nonnull %3) #3
  call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #3
  call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %1) #3
  call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0) #3
  ret i32 0
}

Akash Kothari's avatar
Akash Kothari committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
declare dso_local void @__hpvm__init(...) local_unnamed_addr #0

declare dso_local i8* @__hpvm__launch(i32, ...) local_unnamed_addr #0

declare dso_local void @__hpvm__wait(i8*) local_unnamed_addr #0

declare dso_local void @__hpvm__cleanup(...) local_unnamed_addr #0

declare i8* @llvm_hpvm_initializeTimerSet()

declare void @llvm_hpvm_switchToTimer(i8**, i32)

declare void @llvm_hpvm_printTimerSet(i8**, i8*)

; Function Attrs: nounwind uwtable
define dso_local %struct.out.Func1 @Func1_cloned(i32* in %In, i64 %Insize, i32* out %Out, i64 %Outsize) #2 {
entry:
  %returnStruct = insertvalue %struct.out.Func1 undef, i32* %Out, 0
  ret %struct.out.Func1 %returnStruct
}

; Function Attrs: nounwind
declare i8* @llvm.hpvm.createNode2D(i8*, i64, i64) #3

; Function Attrs: nounwind
declare void @llvm.hpvm.bind.input(i8*, i32, i32, i1) #3

; Function Attrs: nounwind
declare void @llvm.hpvm.bind.output(i8*, i32, i32, i1) #3

; Function Attrs: nounwind uwtable
define dso_local %struct.out.Func3 @Func3_cloned(i32* in %In, i64 %Insize, i32* out %Out, i64 %Outsize) #2 {
; CHECK-NOT: @Func3_cloned
entry:
  %Func1_cloned.node = call i8* @llvm.hpvm.createNode2D(i8* bitcast (%struct.out.Func1 (i32*, i64, i32*, i64)* @Func1_cloned to i8*), i64 3, i64 5)
  call void @llvm.hpvm.bind.input(i8* %Func1_cloned.node, i32 0, i32 0, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func1_cloned.node, i32 1, i32 1, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func1_cloned.node, i32 2, i32 2, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func1_cloned.node, i32 3, i32 3, i1 false)
  call void @llvm.hpvm.bind.output(i8* %Func1_cloned.node, i32 0, i32 0, i1 false)
  ret %struct.out.Func3 undef
}

; Function Attrs: nounwind
declare i8* @llvm.hpvm.createNode1D(i8*, i64) #3

; Function Attrs: nounwind uwtable
define dso_local %struct.out.Func2 @Func2_cloned(i32* in %In, i64 %Insize, i32* out %Out, i64 %Outsize) #2 {
; CHECK-NOT: @Func2_cloned
entry:
  %Func3_cloned.node = call i8* @llvm.hpvm.createNode1D(i8* bitcast (%struct.out.Func3 (i32*, i64, i32*, i64)* @Func3_cloned to i8*), i64 3)
  call void @llvm.hpvm.bind.input(i8* %Func3_cloned.node, i32 0, i32 0, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func3_cloned.node, i32 1, i32 1, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func3_cloned.node, i32 2, i32 2, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func3_cloned.node, i32 3, i32 3, i1 false)
  call void @llvm.hpvm.bind.output(i8* %Func3_cloned.node, i32 0, i32 0, i1 false)
  ret %struct.out.Func2 undef
}

; Function Attrs: nounwind
declare i8* @llvm.hpvm.createNode(i8*) #3

; Function Attrs: nounwind uwtable
define dso_local %struct.out.PipeRoot @PipeRoot_cloned(i32* in %In1, i64 %Insize1, i32* in %In2, i64 %InSize2, i32* out %Out, i64 %Outsize) #2 {
; CHECK-NOT: @PipeRoot_cloned
entry:
  %Func2_cloned.node = call i8* @llvm.hpvm.createNode(i8* bitcast (%struct.out.Func2 (i32*, i64, i32*, i64)* @Func2_cloned to i8*))
  call void @llvm.hpvm.bind.input(i8* %Func2_cloned.node, i32 0, i32 0, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func2_cloned.node, i32 1, i32 1, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func2_cloned.node, i32 2, i32 2, i1 false)
  call void @llvm.hpvm.bind.input(i8* %Func2_cloned.node, i32 3, i32 3, i1 false)
  call void @llvm.hpvm.bind.output(i8* %Func2_cloned.node, i32 0, i32 0, i1 false)
  ret %struct.out.PipeRoot undef
}

; Function Attrs: nounwind
declare void @llvm.hpvm.init() #3
Akash Kothari's avatar
Akash Kothari committed
182

Akash Kothari's avatar
Akash Kothari committed
183
184
; Function Attrs: nounwind
declare i8* @llvm.hpvm.launch(i8*, i8*, i1) #3
Akash Kothari's avatar
Akash Kothari committed
185

Akash Kothari's avatar
Akash Kothari committed
186
187
; Function Attrs: nounwind
declare void @llvm.hpvm.wait(i8*) #3
Akash Kothari's avatar
Akash Kothari committed
188

Akash Kothari's avatar
Akash Kothari committed
189
190
; Function Attrs: nounwind
declare void @llvm.hpvm.cleanup() #3
Akash Kothari's avatar
Akash Kothari committed
191

Akash Kothari's avatar
Akash Kothari committed
192
193
194
attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cpu-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="true" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
attributes #2 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cpu-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="true" "use-soft-float"="false" }
Akash Kothari's avatar
Akash Kothari committed
195
196
197
198
attributes #3 = { nounwind }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
Akash Kothari's avatar
Akash Kothari committed
199
200
201
202
203
204
205
!hpvm_hint_cpu = !{!2, !3, !4, !5}
!hpvm_hint_gpu = !{}
!hpvm_hint_spir = !{}
!hpvm_hint_cudnn = !{}
!hpvm_hint_promise = !{}
!hpvm_hint_cpu_gpu = !{}
!hpvm_hint_cpu_spir = !{}
Akash Kothari's avatar
Akash Kothari committed
206
207

!0 = !{i32 1, !"wchar_size", i32 4}
Akash Kothari's avatar
Akash Kothari committed
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
!1 = !{!"clang version 9.0.0 (https://gitlab.engr.illinois.edu/llvm/hpvm.git 6690f9e7e8b46b96aea222d3e85315cd63545953)"}
!2 = !{%struct.out.Func1 (i32*, i64, i32*, i64)* @Func1_cloned}
!3 = !{%struct.out.Func3 (i32*, i64, i32*, i64)* @Func3_cloned}
!4 = !{%struct.out.Func2 (i32*, i64, i32*, i64)* @Func2_cloned}
!5 = !{%struct.out.PipeRoot (i32*, i64, i32*, i64, i32*, i64)* @PipeRoot_cloned}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 0}
!11 = !{!"Root", !12, i64 0, !13, i64 8, !12, i64 16, !13, i64 24, !12, i64 32, !13, i64 40}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!11, !13, i64 8}
!15 = !{!11, !12, i64 16}
!16 = !{!11, !13, i64 24}
!17 = !{!11, !12, i64 32}
!18 = !{!11, !13, i64 40}