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

remove a double union splitting situation #1010

Closed
wants to merge 1 commit into from
Closed

Conversation

lxvm
Copy link

@lxvm lxvm commented Feb 23, 2024

This could fix a type instability I noticed while working on SciML/SciMLExpectations.jl#148.
I don't have time to add tests for this.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@ChrisRackauckas
Copy link
Member

This makes no difference in the SSA IR since the second assignment is a separate variable.

@lxvm
Copy link
Author

lxvm commented Feb 23, 2024

I found out both u0 and p were inferred as unions of nothing and their intended value by using Cthulhu and @code_warntype also showed a type instability, so this caused some @inferred tests to fail. The problem is that one union gets split, but when there are two the typocalypse begins and inference gives up. I've seen it happen in lots of code. Are you saying it gets optimized away at runtime?

@lxvm lxvm closed this Feb 23, 2024
@lxvm lxvm deleted the patch-1 branch February 23, 2024 18:45
@lxvm
Copy link
Author

lxvm commented Feb 23, 2024

I guess that's why they call Cthulhu the slow descent into madness 😅

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.

2 participants