@@ -3817,30 +3817,29 @@ static bool emit_f_opfield(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
3817
3817
3818
3818
static jl_cgval_t emit_isdefinedglobal (jl_codectx_t &ctx, jl_module_t *modu, jl_sym_t *name, int allow_import, enum jl_memory_order order)
3819
3819
{
3820
- Value *isnull = NULL ;
3821
3820
jl_binding_t *bnd = allow_import ? jl_get_binding (modu, name) : jl_get_module_binding (modu, name, 0 );
3822
3821
struct restriction_kind_pair rkp = { NULL , NULL , PARTITION_KIND_GUARD, 0 };
3823
3822
if (allow_import && jl_get_binding_leaf_partitions_restriction_kind (bnd, &rkp, ctx.min_world , ctx.max_world )) {
3824
- if (jl_bkind_is_some_constant (rkp.kind ))
3825
- return mark_julia_const (ctx, rkp. restriction );
3823
+ if (jl_bkind_is_some_constant (rkp.kind ) && rkp. restriction )
3824
+ return mark_julia_const (ctx, jl_true );
3826
3825
if (rkp.kind == PARTITION_KIND_GLOBAL) {
3827
3826
Value *bp = julia_binding_gv (ctx, rkp.binding_if_global );
3828
3827
bp = julia_binding_pvalue (ctx, bp);
3829
3828
LoadInst *v = ctx.builder .CreateAlignedLoad (ctx.types ().T_prjlvalue , bp, Align (sizeof (void *)));
3830
3829
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA (ctx, ctx.tbaa ().tbaa_binding );
3831
3830
ai.decorateInst (v);
3832
3831
v->setOrdering (get_llvm_atomic_order (order));
3833
- isnull = ctx.builder .CreateICmpNE (v, Constant::getNullValue (ctx.types ().T_prjlvalue ));
3832
+ Value * isnull = ctx.builder .CreateICmpNE (v, Constant::getNullValue (ctx.types ().T_prjlvalue ));
3834
3833
return mark_julia_type (ctx, isnull, false , jl_bool_type);
3835
3834
}
3836
3835
}
3837
- Value *v = ctx.builder .CreateCall (prepare_call (jlboundp_func), {
3836
+ Value *isdef = ctx.builder .CreateCall (prepare_call (jlboundp_func), {
3838
3837
literal_pointer_val (ctx, (jl_value_t *)modu),
3839
3838
literal_pointer_val (ctx, (jl_value_t *)name),
3840
3839
ConstantInt::get (getInt32Ty (ctx.builder .getContext ()), allow_import)
3841
3840
});
3842
- isnull = ctx.builder .CreateICmpNE (v, ConstantInt::get ( getInt32Ty ( ctx.builder .getContext ()), 0 ));
3843
- return mark_julia_type (ctx, isnull , false , jl_bool_type);
3841
+ isdef = ctx.builder .CreateTrunc (isdef, getInt1Ty ( ctx.builder .getContext ()));
3842
+ return mark_julia_type (ctx, isdef , false , jl_bool_type);
3844
3843
}
3845
3844
3846
3845
static bool emit_f_opmemory (jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
0 commit comments