Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1864,14 +1864,15 @@ static jl_cgval_t convert_julia_type_union(jl_codectx_t &ctx, const jl_cgval_t &
boxv = ctx.builder.CreateSelect(
ctx.builder.CreateAnd(wasboxed, isboxed), v.Vboxed, boxv);
}
Value *slotv;
MDNode *tbaa;
if (v.V == NULL) {
// v.V might be NULL if it was all ghost objects before
return jl_cgval_t(boxv, NULL, false, typ, new_tindex, ctx.tbaa());
slotv = NULL;
tbaa = ctx.tbaa().tbaa_const;
}
else {
Value *isboxv = ctx.builder.CreateIsNotNull(boxv);
Value *slotv;
MDNode *tbaa;
if (v.ispointer()) {
slotv = v.V;
tbaa = v.tbaa;
Expand All @@ -1884,12 +1885,12 @@ static jl_cgval_t convert_julia_type_union(jl_codectx_t &ctx, const jl_cgval_t &
slotv = ctx.builder.CreateSelect(isboxv,
decay_derived(ctx, boxv),
decay_derived(ctx, emit_bitcast(ctx, slotv, boxv->getType())));
jl_cgval_t newv = jl_cgval_t(slotv, NULL, false, typ, new_tindex, ctx.tbaa());
assert(boxv->getType() == ctx.types().T_prjlvalue);
newv.Vboxed = boxv;
newv.tbaa = tbaa;
return newv;
}
jl_cgval_t newv = jl_cgval_t(slotv, NULL, false, typ, new_tindex, ctx.tbaa());
assert(boxv->getType() == ctx.types().T_prjlvalue);
newv.Vboxed = boxv;
newv.tbaa = tbaa;
return newv;
}
}
else {
Expand Down
17 changes: 17 additions & 0 deletions test/compiler/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,23 @@ function f42645()
end
@test ((f42645()::B42645).y::A42645{Int}).x

struct A44921{T}
x::T
end
function f44921(a)
if a == :x
A44921(_f) # _f purposefully undefined
elseif a == :p
g44921(a)
end
end
function g44921(a)
if !@isdefined _f # just needs to be some non constprop-able condition
A44921(())
end
end
@test f44921(:p) isa A44921

# issue #43123
@noinline cmp43123(a::Some, b::Some) = something(a) === something(b)
@noinline cmp43123(a, b) = a[] === b[]
Expand Down