-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
3-way comparison is branchier after 1.71 #125338
Copy link
Copy link
Open
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationC-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.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationC-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.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
The following code contains two impls of the same (or what should be the same) logic. Prior to 1.71.0, the first impl (using
Option::map()instead ofmatch) would generate llvm ir that could be optimized to usecmovinstructions, but the second impl (usingmatchinstead) would use jumps instead.1.71.0+ generate the same (branchy) llvm ir for both implementations.
The regression goes away if compiling with
-Zinline-mir=no, but thematchimplementation remains branchy.Godbolt link
Optimized IR:
compiling to following x86_64:
vs unoptimized ir and asm:
Version it worked on
It most recently worked on: 1.70.0
Version with regression
rustc --version --verbose:@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged +A-codegen +C-bug +I-slow +T-compiler
cc #91743