-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.P-mediumMedium priorityMedium priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
I tried this code:
pub fn a(c: char) -> bool {
c == 's' || c == 'm' || c == 'h' || c == 'd' || c == 'w'
}
pub fn b(c: char) -> bool {
matches!(c, 's' | 'm' | 'h' | 'd' | 'w')
}
When compiled with the latest stable version and look at the objdump, I see a combined version of a and b, because they are optimized to the same instructions and then merged in the library.
On nightly (already bisected) two copies are stored and it takes the double amount of space (3.9kIB vs 4.1kIB).
Here's a godbolt link: https://rust.godbolt.org/z/zWovojdEE
Version it worked on
It most recently worked on: 1.57.0
Doesn't work since: 63cc2bb cc #88243 @nikic
@rustbot modify labels: +regression-from-stable-to-nightly +I-heavy
MSxDOS
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.P-mediumMedium priorityMedium priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.