Skip to content

Commit 32226da

Browse files
committed
uncomment harmless branch
1 parent eee1837 commit 32226da

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/cgutils.cpp

+14-6
Original file line numberDiff line numberDiff line change
@@ -1062,23 +1062,31 @@ static std::pair<Value*, bool> emit_isa(jl_codectx_t &ctx, const jl_cgval_t &x,
10621062
{
10631063
jl_value_t *intersected_type = type;
10641064

1065-
// TODO: The commented-out part of this optimization suffers from incorrectness issues
1066-
// due to broken subtyping for kind types (see
1067-
// https://github.com/JuliaLang/julia/issues/27078). For actual `isa` calls, this
1068-
// optimization should already have been performed upstream anyway, but having this
1069-
// optimization in codegen might still be beneficial for `typeassert`s if we can make it
1070-
// correct.
10711065
Optional<bool> known_isa;
10721066
if (x.constant) {
10731067
known_isa = jl_isa(x.constant, type);
1068+
} else {
1069+
intersected_type = jl_type_intersection(x.typ, type);
1070+
if (intersected_type == (jl_value_t*)jl_bottom_type)
1071+
known_isa = false;
10741072
}
1073+
1074+
// TODO: This commented-out version of the above check suffers from incorrectness
1075+
// issues due to broken subtyping for kind types (see
1076+
// https://github.com/JuliaLang/julia/issues/27078). For actual `isa` calls, this
1077+
// optimization should already have been performed upstream anyway, but having this
1078+
// optimization in codegen might still be beneficial for `typeassert`s if we can make it
1079+
// correct.
1080+
// if (x.constant) {
1081+
// known_isa = jl_isa(x.constant, type);
10751082
// else if (jl_subtype(x.typ, type))
10761083
// known_isa = true;
10771084
// else {
10781085
// intersected_type = jl_type_intersection(x.typ, type);
10791086
// if (intersected_type == (jl_value_t*)jl_bottom_type)
10801087
// known_isa = false;
10811088
// }
1089+
10821090
if (known_isa) {
10831091
if (!*known_isa && msg) {
10841092
emit_type_error(ctx, x, literal_pointer_val(ctx, type), *msg);

0 commit comments

Comments
 (0)