File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -261,21 +261,6 @@ const __llvm_initialized = Ref(false)
261
261
end
262
262
263
263
@timeit_debug to " IR post-processing" begin
264
- # some early clean-up to reduce the amount of code to optimize
265
- @timeit_debug to " clean-up" begin
266
- ModulePassManager () do pm
267
- # eliminate all unused internal functions
268
- global_optimizer! (pm)
269
- global_dce! (pm)
270
- strip_dead_prototypes! (pm)
271
-
272
- # merge constants (such as exception messages)
273
- constant_merge! (pm)
274
-
275
- run! (pm, ir)
276
- end
277
- end
278
-
279
264
if optimize
280
265
@timeit_debug to " optimization" begin
281
266
optimize! (job, ir)
@@ -304,6 +289,22 @@ const __llvm_initialized = Ref(false)
304
289
entry = functions (ir)[entry_fn]
305
290
end
306
291
292
+ @timeit_debug to " clean-up" begin
293
+ # we can only clean-up now, as optimization may lower or introduce calls to
294
+ # functions from the GPU runtime (e.g. julia.gc_alloc_obj -> gpu_gc_pool_alloc)
295
+ ModulePassManager () do pm
296
+ # eliminate all unused internal functions
297
+ global_optimizer! (pm)
298
+ global_dce! (pm)
299
+ strip_dead_prototypes! (pm)
300
+
301
+ # merge constants (such as exception messages)
302
+ constant_merge! (pm)
303
+
304
+ run! (pm, ir)
305
+ end
306
+ end
307
+
307
308
# replace non-entry function definitions with a declaration
308
309
# NOTE: we can't do this before optimization, because the definitions of called
309
310
# functions may affect optimization.
You can’t perform that action at this time.
0 commit comments