-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Make unconditional_recursion
work across function boundaries
#75067
Conversation
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 6becae3d4de52eabf72d7b69f006573ddfecf267 with merge de45839e975f8517340a4e9a2c1cee0a92e4b812... |
☀️ Try build successful - checks-actions, checks-azure |
Queued de45839e975f8517340a4e9a2c1cee0a92e4b812 with parent a99ae95, future comparison URL. |
Finished benchmarking try commit (de45839e975f8517340a4e9a2c1cee0a92e4b812): 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 |
I've pushed a new commit that implements this in a better way, but for some reason it breaks all the incremental tests |
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.
from tcx.ensure()
:
/// Ensure that either this query has all green inputs or been executed.
So if inevitable_calls
is green and mir_const
is not, we actually don't execute inevitable_calls
. As we do not cache it on disk, this would mean that when we later need the actual query content, we do have to recompute it, but at this point mir_built
has already been stolen afaict.
I think we can either cache this query on disk (which is probably quite costly) or not use ensure
in mir_const
🤔
Thanks, that fixed the issue! |
Lets run perf again with the query in place. @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 95484733cd28cbf411a16c68f6a25cc1a8d38ed9 with merge 89143ca40dfdf0be97901f1853b15fe7a8e83a23... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 89143ca40dfdf0be97901f1853b15fe7a8e83a23 with parent 108e90c, future comparison URL. |
Finished benchmarking try commit (89143ca40dfdf0be97901f1853b15fe7a8e83a23): 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 |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit f537570bae0605b2c6749ba9b16088720e2ec771 with merge d8aa519edb0359cf70d42b14771e587f3a6bc4ca... |
☀️ Try build successful - checks-actions, checks-azure |
Queued d8aa519edb0359cf70d42b14771e587f3a6bc4ca with parent 663d2f5, future comparison URL. |
Finished benchmarking try commit (d8aa519edb0359cf70d42b14771e587f3a6bc4ca): 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 |
Better than the previous perf run, but still a significant regression. (up to 8%) |
src/librustc_mir/lints.rs
Outdated
|
||
// All callees that are guaranteed to be reached by every successor will also be reached by | ||
// `bb`. Compute the intersection. | ||
let successors = relevant_successors.copied(); |
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.
nit: style
this copied
seems somewhat weird, can we instead match on terminator.kind
in the above match and directly iterate by value?
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.
The SwitchInt
targets
is a Vec
, otherwise this would work.
) -> &'tcx [(DefId, SubstsRef<'tcx>, &'tcx [Span])] { | ||
tcx.arena.alloc_from_iter( | ||
find_inevitable_calls(tcx, key) | ||
.map(|(callee, spans)| (callee.def_id, callee.substs, &*tcx.arena.alloc_slice(&spans))), |
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.
We do allocate a lot to have the correct spans here. I think it would make a lot of sense to do a perf run without storing the relevant spans and only mention the function header of used functions in the lint.
And if that reduces the perf impact using an ArrayVec
and only storing a limited number of spans or using a SmallVec
might be interesting.
src/librustc_mir/lints.rs
Outdated
fn find_inevitable_calls<'tcx>( | ||
tcx: TyCtxt<'tcx>, | ||
def_id: DefId, | ||
) -> impl Iterator<Item = (Callee<'tcx>, Vec<Span>)> { |
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.
) -> impl Iterator<Item = (Callee<'tcx>, Vec<Span>)> { | |
) -> Option<impl Iterator<Item = (Callee<'tcx>, Vec<Span>)>> { |
nit: might be slightly more efficient and imo cleaner
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 94dc317f8b684b47db0af3c09f94bf11393cb63e with merge 55691358cfa29310103a6ec5c25e35f0f611abc6... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 55691358cfa29310103a6ec5c25e35f0f611abc6 with parent 2342cc3, future comparison URL. |
Finished benchmarking try commit (55691358cfa29310103a6ec5c25e35f0f611abc6): 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 |
No changes from not tracking call spans. Most of the perf regressions seem to be due to more queries being run (but we shouldn't really call |
@bors try @rust-timer queue |
Awaiting bors try build completion |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit d5d1603 with merge e8af76ec43b470394ef27523cf8644cf23cd741c... |
☀️ Try build successful - checks-actions, checks-azure |
Queued e8af76ec43b470394ef27523cf8644cf23cd741c with parent d02a209, future comparison URL. |
Finished benchmarking try commit (e8af76ec43b470394ef27523cf8644cf23cd741c): 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 |
Closing this due to inactivity. The benchmarks don't paint a good picture as well. |
First step towards #57965