-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Prepare ConstVal for constant propagators and reduce eval_const_expr
in MIR
#33274
Conversation
@oli-obk I disagree with putting MIR constant aggregates in |
I'm not sure I understand. We can refactor |
@oli-obk Yes, but you can't copy the |
When I suggested that on #rust-internals, I was told that we should end up merging aggregates that consist solely of constants into a constant aggregate.
Ah, we're talking about different structures. The fact that constprop exists should not change the MIR. The MIR should represent the code as is. All constant propagation can do is manipulate that code. The constant propagation pass can have internal datastructures that store additional info about certain temp/var decls. This way the const prop pass can propagate more than constants (it can do move-skips like |
☔ The latest upstream changes (presumably #33303) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #33425) made this pull request unmergeable. Please resolve the merge conflicts. |
this didn't work very well anyway, because const_eval can't eval all kinds of constants.
@eddyb any update on the design decision? +rebased |
@rust-lang/compiler, do we want to discuss this PR today? |
let's discuss tomorrow, along with a bit more about constants in general |
Did the discussion yield any results wrt aggregate constants? |
We never did talk about it :( |
☔ The latest upstream changes (presumably #33905) made this pull request unmergeable. Please resolve the merge conflicts. |
since my original notion was to not have aggregates in MIR, and @eddyb feels that way, too, I'll close this. |
rebased eager const eval over @eddyb 's MIR-constants PR #33130
fixes #29928
fixes #33252
eval_const_expr
on literals and negated literalseval_const_expr
can't eval all kinds of constantseval_const_expr_partial
ConstVal
contains owned versions of struct fields, tuple fields, array elements and the repeat valueRvalue::Aggregate
into a constantr? @eddyb