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

Ensure stdlib parses again after #79186. #79567

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

3405691582
Copy link
Contributor

That pr converted PredictableMemoryAccessOptimizations function pass to Swift. Both versions of this pass remove unreachable terminators at the end of apparent infinite loops that are guaranteed to eventually return. The stdlib has a number of instances where apparent infinite loops are used.

When Swift host tools are available, so are the Swift function passes, and these unreachable terminators are removed as before. However, when the host tools are not available (e.g., using a configuration like the stdlib and we get a dataflow error manifesting as a "missing return".

To extricate ourselves out of this situation, we have a few options.

One option is determining that #79186 marks the end of the road for the compiler to be bootstrapped from C++. However, that is somewhat unsatisfying, since there is a great reticence to accepting maintenance patches on previous compiler branches and leaves questions about how an older version of the "bootstrap" compiler should be kept up-to-date, since presumably as new platforms come online to bootstrap Swift, code changes to C++ would still be warranted.

Alternatively, there is already a stated goal that the C++ compiler should not necessarily emit the most optimized code, and that the compiler built with Swift host tools would emit better optimized code. In this case, we would want to add an additional pass for the bootstrap compiler to just detect the apparent infinite loop case and make sure no errors occur. This is probably the correct thing to do, however, it is probably a slightly nontrivial undertaking.

In the meantime, we need to ensure we can continue to bootstrap with the spot where the "missing return" error happens. This is not exactly the cleanest solution, but it does ensure the build is fixed again in this configuration.

(Because this is not perhaps the best solution to address this problem, I've made this a draft pr instead, so at least this unblocks builds.)

That pr converted PredictableMemoryAccessOptimizations function pass to
Swift. Both versions of this pass remove unreachable terminators at the
end of apparent infinite loops that are guaranteed to eventually return.
The stdlib has a number of instances where apparent infinite loops are
used.

When Swift host tools are available, so are the Swift function passes,
and these unreachable terminators are removed as before. However, when
the host tools are not available (e.g., using a configuration like
the stdlib and we get a dataflow error manifesting as a "missing
return".

To extricate ourselves out of this situation, we have a few options.

One option is determining that swiftlang#79186 marks the end of the road for the
compiler to be bootstrapped from C++. However, that is somewhat
unsatisfying, since there is a great reticence to accepting maintenance
patches on previous compiler branches and leaves questions about how an
older version of the "bootstrap" compiler should be kept up-to-date,
since presumably as new platforms come online to bootstrap Swift, code
changes to C++ would still be warranted.

Alternatively, there is already a stated goal that the C++ compiler
should not necessarily emit the most optimized code, and that the
compiler built with Swift host tools would emit better optimized code.
In this case, we would want to add an additional pass for the bootstrap
compiler to just detect the apparent infinite loop case and make sure no
errors occur. This is probably the correct thing to do, however, it is
probably a slightly nontrivial undertaking.

In the meantime, we need to ensure we can continue to bootstrap with the
spot where the "missing return" error happens. This is not exactly the
cleanest solution, but it does ensure the build is fixed again in this
configuration.
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.

1 participant