-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
missed optimization when writing a value with inner padding. #157373
Copy link
Copy link
Open
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Metadata
Metadata
Assignees
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
I tried this code:
I expected to see this happen: each function would result in either 2 4-byte stores of 0 or one 8-byte store of 0 dependinding on how the compiler deals with the alignement.
what happened :
both
badandbad_tooavoided writing the padding byte, even though there is no reason for them to do so.this has been the case since
1.81whenMaybeUninit::writewas stabilizedgodbolt link ; https://godbolt.org/z/Yj6GWhebq
this might be an llvm issue, but i gigured it might be best to ask here first