-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Weird Match Statement Codegen With Byte Strings #103073
Copy link
Copy link
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.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
C-bugCategory: This is a bug.Category: This is a bug.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.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.
It seems that with the following snippet of code results in some rather strange codegen:
The following is produced with
-C opt-level=2:I would expect something like this to be produced instead (specifically with optimizations enabled):
An example is available here: https://rust.godbolt.org/z/EEKr43rP8
For what it's worth, at
-C opt-level=0it becomes apparent that theif/elseversion usesPartialEqwhile thematchversion doesn't. I suspect that this is resulting in the optimizations for the two examples being processed differently.Meta
rustc --version --verbose: