-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Optimize matches!() invocations at the MIR level #75141
Copy link
Copy link
Closed
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Right now,
matches!()generates MIR that sometimes has more branches than required. As an example:generates this MIR:
Notice blocks
bb0,bb1,bb2andbb3which we could transform into something like this:There may be a compile-time win since we can hand LLVM less code but the optimization would have to be implemented to be sure.
cc @rust-lang/wg-mir-opt