Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the no_preserve_tags_attribute #582

Closed

Conversation

arichardson
Copy link
Member

Split out from #506 to make that a bit easier to review.

This is the opposite of the existing must_preserve_cheri_tags and can be
used to indicated that a memcpy/memmove will never copy capabilities and
can therefore be inlined even when larger than the capability size and
aligned to less than the capability size.
The motivating case for this is that we currently call memcpy when
performing structure assignment for struct { long a; long b;} rather
than using two loads+stores.
Also add a global helper function that can be used to get the attribute
from calls to library functions such as memcpy (since those CallInsts are
not subclasses of MemTransferInst).
@arichardson
Copy link
Member Author

Slightly less churn in this version by adding a default argument.

@arichardson
Copy link
Member Author

Longer-term I am not sure we need the must_preserve_tags attribute anymore since not having the attribute means we have to assume tags are preserved.

This refactoring is required to allow inlining of non-tag-preserving
memcpy instructions with size > sizeof(cap) && alignment < alignof(cap).
…ends

This will allow setting the PreserveCheriTags flag in Clang and in
optimization passes such as SimplifyLibcalls, etc.
This commit only adds the argument with a default value to avoid
merge conflicts for passes where we would just pass ::Unknown.
Eventually the default argument should be removed but that means we have
to audit all current call sites. A follow-up commit will use this flag
in the individual backends to ensure that structures without capabilities
can be copied efficiently.
This avoids churn in upstream tests due to additional attributes.
To check whether we CHERI capabilities are supported, we check whether
the DataLayout has any address spaces tagged as fat pointers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant