Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a regression in the test for #13432 #55004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Keno
Copy link
Member

@Keno Keno commented Jul 2, 2024

The test for #13432 is supposed to test a particular codegen path involving Bottom. It turns out that this code path is regressed on master, but hidden by the fact that in modern julia, the optimizer can fold this code path early. Fix the bug and add a variant of the test that shows the issue on julia master. Note that this is both an assertion failure and incorrect codegen. This PR addresses both.

@Keno Keno requested a review from vtjnash July 2, 2024 20:02
The test for #13432 is supposed to test a particular codegen path
involving Bottom. It turns out that this code path is regressed on
master, but hidden by the fact that in modern julia, the optimizer
can fold this code path early. Fix the bug and add a variant of the
test that shows the issue on julia master. Note that this is both
an assertion failure and incorrect codegen. This PR addresses both.
Value *istype_boxed = ctx.builder.CreateICmpEQ(emit_typeof(ctx, arg.Vboxed, false, true), emit_tagfrom(ctx, dt));
Value *istype_boxed = NULL;
if (is_uniquerep_Type((jl_value_t*)dt)) {
istype_boxed = ctx.builder.CreateICmpEQ(decay_derived(ctx, arg.Vboxed), decay_derived(ctx, literal_pointer_val(ctx, jl_tparam0(dt))));
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This jl_tparam0 result does not appear to be GC-rooted anywhere, otherwise, SGTM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should inherit the root from dt.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that makes sense, assuming dt gets a root?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed they were interned, since we make that same assumption elsewhere in codegen. If not, we'll need a bigger change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants