Skip to content

Commit 378f192

Browse files
authored
precompile: Ensure CI has inference results available for jl_create_native (#55528)
`jl_emit_codeinst` expects inference results to be available, so `jl_ci_cache_lookup` needs to provide a CI that has them. I noticed this because it was causing missing code when, e.g., compiling `NetworkOptions.__init__` using `--trim` (#55047). Unfortunately `jl_emit_codeinst` failures are silently ignored (they just leave the LLVM module empty), so it was easy to miss that the looked-up CIs sometimes fail to compile.
1 parent ec2d696 commit 378f192

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/aotcompile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jl_code_instance_t *jl_ci_cache_lookup(const jl_cgparams_t &cgparams, jl_method_
284284
jl_value_t *ci = cgparams.lookup(mi, world, world);
285285
JL_GC_PROMISE_ROOTED(ci);
286286
jl_code_instance_t *codeinst = NULL;
287-
if (ci != jl_nothing) {
287+
if (ci != jl_nothing && jl_atomic_load_relaxed(&((jl_code_instance_t *)ci)->inferred) != jl_nothing) {
288288
codeinst = (jl_code_instance_t*)ci;
289289
}
290290
else {

0 commit comments

Comments
 (0)