mir_build: Add an extra intermediate step in MIR building for patterns #155144
mir_build: Add an extra intermediate step in MIR building for patterns #155144Zalathar wants to merge 4 commits intorust-lang:mainfrom
Conversation
This makes it easier to perform coordinated modifications to `FlatPat::new` and `MatchPairTree::from_pattern`, because the two functions are heavily coupled.
|
|
This comment has been minimized.
This comment has been minimized.
This splits out a separate `InterPat` data structure from `MatchPairTree`/`FlatPat`/`Candidate`, which should hopefully make it easier to modify these earlier parts of match lowering without having to simultaneously adjust many use-sites in later steps.
|
@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.
mir_build: Add an extra intermediate step in MIR building for patterns
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (76367e4): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 2.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -9.8%, secondary -4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 491.148s -> 509.241s (3.68%) |
This is an attempt to partly decouple the data structures created by
match_pair.rsfrom the data structures that are ultimately consumed by the main part of match lowering.In some ways this is a reversal from #137875. That PR succeeded in removing the
TestCase::Irrefutablevariant, by taking a pre-existing “simplification” step and fusing it directly intoMatchPairTree::for_pattern. Unfortunately, in doing so it also reinforced a very high degree of coupling between the transformations performed inmatch_pair, and the data structures used by later steps.My hope is that these changes will make it easier for follow-up work to further separate decision-making from MIR building when lowering patterns.
Currently marked as draft because I want to double-check perf, and because I want to spend some more time thinking about whether this is a good direction.
r? Nadrieril