-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Implement constant folding in the frontend #7834
Comments
If |
I imagine that |
Until now, we only optimized away impossible branches when there is a literal true/false in the code. But since the LLVM IR builder already does constant folding for us, we can trivially expand that to work with constants as well. Refs rust-lang#7834
visiting for (long long delayed) triage. Should we consider differentiating between the two issues being described here? (I.e. one is a pure front-end optimization which could have great follow-on effects improving rustc performance; the second sounds like a user-visible feature, at least in its most general form...) |
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#685 |
We should be able to do constant folding in the frontend to eliminate "if" conditions that are never executed. It would also be nice to be able to call
size_of
at compile time in constants. (This latter part is an RFC.)The text was updated successfully, but these errors were encountered: