File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -246,16 +246,6 @@ const __llvm_initialized = Ref(false)
246
246
247
247
# some early clean-up to reduce the amount of code to optimize
248
248
@timeit_debug to " clean-up" begin
249
- # replace non-entry function definitions with a declaration
250
- if only_entry
251
- for f in functions (ir)
252
- f == entry && continue
253
- isdeclaration (f) && continue
254
- LLVM. isintrinsic (f) && continue
255
- empty! (f)
256
- end
257
- end
258
-
259
249
ModulePassManager () do pm
260
250
# mark everything internal except for the entry and exported global variables.
261
251
# this makes sure that the optimizer can, e.g., touch function signatures.
@@ -299,6 +289,18 @@ const __llvm_initialized = Ref(false)
299
289
entry = functions (ir)[entry_fn]
300
290
end
301
291
292
+ # replace non-entry function definitions with a declaration
293
+ # NOTE: we can't do this before optimization, because the definitions of called
294
+ # functions may affect optimization.
295
+ if only_entry
296
+ for f in functions (ir)
297
+ f == entry && continue
298
+ isdeclaration (f) && continue
299
+ LLVM. isintrinsic (f) && continue
300
+ empty! (f)
301
+ end
302
+ end
303
+
302
304
# remove the kernel state dummy use
303
305
if haskey (functions (ir), " julia.gpu.state_user" )
304
306
dummy_user = functions (ir)[" julia.gpu.state_user" ]
You can’t perform that action at this time.
0 commit comments