-
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 MutVisitor
s to handle interned projections
#65197
Prepare MutVisitor
s to handle interned projections
#65197
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to reuse the existing visit_local
more instead of duplicating its logic (even if the code is super tiny). You could always clone the elem
and mutate it by calling self.visit_local
. Or create a LocalMutVisitor
trait that internally uses MutVisitor
and does the vec->mutate->collect->into_boxed_slice dance
ec5e77f
to
021a77b
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
6b9316b
to
04e491a
Compare
04e491a
to
cdf33d9
Compare
@oli-obk @nikomatsakis I've fixed the things we have discussed and I've decided to split this PR in the let's not mutate projection and the interning part so we can make progress. I don't see a reason why this would regress performance, anyway just asking bots to run perf on this PR. So the main discussion is if we want this macro or something like the following design proposed by @nikomatsakis ... trait PlaceVisitor: MirVisitor { // no MutVisitor equivalent
fn visit_projection(...);
}
impl<'tcx> MirVisitor<'tcx> for Promoter<'_, 'tcx> {
delegate_super_place!(self);
// macro creates:
fn super_place(self) {
for each projection { self.visit_projection(...); }
}
}
impl<'a, 'tcx> PlaceVisitor<'tcx> for Promoter<'a, 'tcx> {
} If I remember correctly Niko said that this was going to be worser than my solution but I don't remember why. @bors try @rust-timer queue |
Awaiting bors try build completion |
Prepare `MutVisitor`s to handle interned projections The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it. ``` [-] src/librustc_mir/transform/no_landing_pads.rs [x] src/librustc_mir/transform/promote_consts.rs [x] src/librustc_mir/transform/generator.rs [x] src/librustc_mir/transform/erase_regions.rs [-] src/librustc_mir/transform/instcombine.rs [x] src/librustc_mir/transform/inline.rs [x] src/librustc_mir/transform/simplify.rs [x] src/librustc_mir/util/def_use.rs [-] src/librustc_mir/transform/const_prop.rs [-] src/librustc_mir/transform/cleanup_post_borrowck.rs [x] src/librustc_mir/borrow_check/nll/renumber.rs [-] src/librustc_mir/transform/copy_prop.rs ``` There is some code repetition, just created the PR so we can start discussing it. /cc @oli-obk @nikomatsakis
☀️ Try build successful - checks-azure |
Queued dc67089 with parent d4f7f97, future comparison URL. |
Finished benchmarking try commit dc67089, comparison URL. |
Perf seems like noise |
Yeap, this is a step before interning where perf I guess there should be some perf wins. So this is ready to merge re-review and merge. |
b766eb2
to
ae806f9
Compare
ae806f9
to
4834996
Compare
@bors r+ |
📌 Commit 4834996 has been approved by |
…s2, r=oli-obk Prepare `MutVisitor`s to handle interned projections The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it. ``` [-] src/librustc_mir/transform/no_landing_pads.rs [x] src/librustc_mir/transform/promote_consts.rs [x] src/librustc_mir/transform/generator.rs [x] src/librustc_mir/transform/erase_regions.rs [-] src/librustc_mir/transform/instcombine.rs [x] src/librustc_mir/transform/inline.rs [x] src/librustc_mir/transform/simplify.rs [x] src/librustc_mir/util/def_use.rs [-] src/librustc_mir/transform/const_prop.rs [-] src/librustc_mir/transform/cleanup_post_borrowck.rs [x] src/librustc_mir/borrow_check/nll/renumber.rs [-] src/librustc_mir/transform/copy_prop.rs ``` There is some code repetition, just created the PR so we can start discussing it. /cc @oli-obk @nikomatsakis
…s2, r=oli-obk Prepare `MutVisitor`s to handle interned projections The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it. ``` [-] src/librustc_mir/transform/no_landing_pads.rs [x] src/librustc_mir/transform/promote_consts.rs [x] src/librustc_mir/transform/generator.rs [x] src/librustc_mir/transform/erase_regions.rs [-] src/librustc_mir/transform/instcombine.rs [x] src/librustc_mir/transform/inline.rs [x] src/librustc_mir/transform/simplify.rs [x] src/librustc_mir/util/def_use.rs [-] src/librustc_mir/transform/const_prop.rs [-] src/librustc_mir/transform/cleanup_post_borrowck.rs [x] src/librustc_mir/borrow_check/nll/renumber.rs [-] src/librustc_mir/transform/copy_prop.rs ``` There is some code repetition, just created the PR so we can start discussing it. /cc @oli-obk @nikomatsakis
Rollup of 17 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65417 (Add more coherence tests) - #65434 (Add long error explanation for E0577) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65496 (properly document panics in div_euclid and rem_euclid) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65471 (Add long error explanation for E0578) r? @ghost
…s2, r=oli-obk Prepare `MutVisitor`s to handle interned projections The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it. ``` [-] src/librustc_mir/transform/no_landing_pads.rs [x] src/librustc_mir/transform/promote_consts.rs [x] src/librustc_mir/transform/generator.rs [x] src/librustc_mir/transform/erase_regions.rs [-] src/librustc_mir/transform/instcombine.rs [x] src/librustc_mir/transform/inline.rs [x] src/librustc_mir/transform/simplify.rs [x] src/librustc_mir/util/def_use.rs [-] src/librustc_mir/transform/const_prop.rs [-] src/librustc_mir/transform/cleanup_post_borrowck.rs [x] src/librustc_mir/borrow_check/nll/renumber.rs [-] src/librustc_mir/transform/copy_prop.rs ``` There is some code repetition, just created the PR so we can start discussing it. /cc @oli-obk @nikomatsakis
Rollup of 19 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65334 (Add long error explanation for E0575) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65493 (Add long error explanation for E0584) - #65496 (properly document panics in div_euclid and rem_euclid) - #65498 (Plugins deprecation: don’t suggest simply removing the attribute) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65535 (rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65390 (Add long error explanation for E0576) - #65434 (Add long error explanation for E0577) - #65471 (Add long error explanation for E0578) r? @ghost
☔ The latest upstream changes (presumably #65570) made this pull request unmergeable. Please resolve the merge conflicts. |
… r=oli-obk Intern place projection This should sit on top of rust-lang#65197. After that one merged, I'm gonna rebase on top of it. The important commits are the last three and there's a bunch of code repetition that I'm going to remove but for that I need to refactor some things that probably need to be added before this PR. Anyway this work helps as is because we can run perf tests :). r? @oli-obk /cc @nikomatsakis
… r=oli-obk Intern place projection This should sit on top of rust-lang#65197. After that one merged, I'm gonna rebase on top of it. The important commits are the last three and there's a bunch of code repetition that I'm going to remove but for that I need to refactor some things that probably need to be added before this PR. Anyway this work helps as is because we can run perf tests :). r? @oli-obk /cc @nikomatsakis
The following are all the files where mir's
MutVisitor
is implemented. The-
there stands for no changes,visit_place
wasn't making any change onPlace
s.x
stands for this file was changed to makevisit_place
do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it.There is some code repetition, just created the PR so we can start discussing it.
/cc @oli-obk @nikomatsakis