-
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
normalize mir::Constant differently from ty::Const in preparation for valtrees #83207
Conversation
Some changes occured to rustc_codegen_cranelift cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
I don't really get what this is about.^^ Normalization is not an area of the compiler that I ever had much contact with. What I would have expected to happen is that normalization only occurs on constants that arise in types. But then why is |
I did try not eagerly evaluating Normalization is performed on MIR data structures when monomorphizing said data structures. Since constants that occur in types have MIR bodies for getting evaluated, there is some link between the two. |
All review comments have been addressed |
This comment has been minimized.
This comment has been minimized.
Okay... no idea what this entails but I'll trust it makes sense. :) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 0c73c0f99a34797048663ed97f23bef7b789ca1f with merge 91aa315e65b19839dca8da5a8cca9ff37c5614b3... |
☀️ Try build successful - checks-actions |
Queued 91aa315e65b19839dca8da5a8cca9ff37c5614b3 with parent b97fd3e, future comparison URL. |
Finished benchmarking try commit (91aa315e65b19839dca8da5a8cca9ff37c5614b3): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
The stress tests regressed. Looking at the details, we have 40% fewer |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
Finished benchmarking try commit (7409b4198347a26b96fdc2e2066c937a2af64972): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
☀️ Try build successful - checks-actions |
Local perf run (with the latest try build, not the same as the perf run above):
|
@bors r=lcnr (changes to previous approval are: some useless commits removed, some inline attributes added). |
📌 Commit c6676db has been approved by |
⌛ Testing commit c6676db with merge 18b838f728bf7578c7a5821d4e563ac758f60f5b... |
@bors retry |
⌛ Testing commit c6676db with merge 98107010e61a1adef6724de613e2daf33ca41c9e... |
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions |
Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a
fold_constant
method toTypeFolder
and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalizemir::Constant
directly into amir::ConstantKind::Val
instead of relying on thety::Const
evaluation.In the future we can get rid of the
ty::Const
in there entirely and add our ownUnevaluated
variant tomir::ConstantKind
. This would allow us to remove thepromoted
field fromty::ConstKind::Unevaluated
, as promoteds can never occur in the type system.cc @rust-lang/wg-const-eval
r? @lcnr