-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Inline super visit/fold methods. #151039
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
base: main
Are you sure you want to change the base?
Inline super visit/fold methods. #151039
Conversation
These should have been removed in rust-lang#139768, which removed the blanket impls and separated the fallible/infallible method implementations.
The theory here is that this kind of pattern is very common:
```
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
if matches!(t.kind(), ty::Param(..)) {
return Ty::new_error(self.tcx, self.error());
}
t.super_fold_with(self)
}
```
I.e. we match on the kind, do something specific for one (or a few) variants.
Otherwise, we fall back to `super_fold_with`, which also does a match on the
kind. By inlining `super_fold_with`, hopefully the optimizer can effectively
combine the two matches into one.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Inline super visit/fold methods.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (ed52d0c): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 475.39s -> 472.016s (-0.71%) |
r? @ghost