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 bug related to speculative inlining and data flow #3634

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Gbury
Copy link
Contributor

@Gbury Gbury commented Feb 27, 2025

This PR fixes a bug that can happen when loopifying a function, where during speculative inlining, data_flow would be run with call to the self continuation, but in a context where self is not known to data_flow (since we are only analyzing the inlined body, where self is not bound).

The solution here is simply to not perform loopification of calls during speculative inlining. Note that once the inlining decision is made, when we rebuild the actual term, we still loopify as before, i.e. the patch only affects speculative inlining (where compilation currently fails, so we do not lose anything). Nevertheless, in the future, we may be interested in trying to count the benefit of the loopification.

Note: this is a 2 line-change (plus some comment for explanation), the rest is re-indentation, so reviewers are encouraged to use the ignore-whitespace-diff option.

@Gbury Gbury added bug Something isn't working flambda2 Prerequisite for, or part of, flambda2 labels Feb 27, 2025
@Gbury Gbury requested a review from Ekdohibs February 27, 2025 15:15
Copy link
Contributor

@chambart chambart left a comment

Choose a reason for hiding this comment

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

This does fix the bug.

@Gbury Gbury force-pushed the fix_loopify_dataflow branch 2 times, most recently from e1d428b to 185115e Compare February 27, 2025 16:51
@Gbury Gbury force-pushed the fix_loopify_dataflow branch from 185115e to f83a746 Compare February 28, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flambda2 Prerequisite for, or part of, flambda2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants