Skip to content

Commit b9a3f30

Browse files
committed
fix #37872, avoid cycles in codegen for ===
1 parent 0a04f41 commit b9a3f30

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/codegen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,8 +2564,8 @@ static Value *emit_f_is(jl_codectx_t &ctx, const jl_cgval_t &arg1, const jl_cgva
25642564
(jl_pointer_egal(rt1) || jl_pointer_egal(rt2)))
25652565
return ctx.builder.CreateICmpEQ(boxed(ctx, arg1), boxed(ctx, arg2));
25662566

2567-
bool justbits1 = jl_is_concrete_immutable(rt1);
2568-
bool justbits2 = jl_is_concrete_immutable(rt2);
2567+
bool justbits1 = jl_is_concrete_immutable(rt1) && ((jl_datatype_t*)rt1)->isinlinealloc;
2568+
bool justbits2 = jl_is_concrete_immutable(rt2) && ((jl_datatype_t*)rt2)->isinlinealloc;
25692569
if (justbits1 || justbits2) { // whether this type is unique'd by value
25702570
return emit_nullcheck_guard2(ctx, nullcheck1, nullcheck2, [&] () -> Value* {
25712571
jl_value_t *typ = justbits1 ? rt1 : rt2;

test/compiler/codegen.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,3 +495,8 @@ let x = reinterpret(Has256Bits, [0xfcdac822cac89d82de4f9b3326da8294, 0x6ebac4d59
495495
@test reinterpret(UInt128, [h(x)]) == lshifted
496496
@test reinterpret(UInt128, [Base.shl_int(x, 0x8)]) == lshifted
497497
end
498+
499+
# issue #37872
500+
let f(@nospecialize(x)) = x===Base.ImmutableDict(Int128=>:big)
501+
@test !f(Dict(Int=>Int))
502+
end

0 commit comments

Comments
 (0)