-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Performance: Layout::align() can assume, that the alignment is a power of two #75264
Copy link
Copy link
Open
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.
An alignment is guaranteed to be a power of two. However without intrinsics it's not possible to use this guarantee when constructing a new
Layoutfrom an old one only changing the size. For testing I used the following code:dynamic_fastassumes, that the alignment returned fromLayoutis a power of two. This results in this assembly:While in the static case, this does not matter, the dynamic case don't have to check
align.is_power_of_two().Normally, I would create a pull request, which adds the intrinsic to
Layout::align(), butcore::intrinsics::assumeis not available inconst fns.