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

Fix lowering of must_preserve_tags memset without capabilities #734

Merged

Conversation

arichardson
Copy link
Member

Noticed this while merging Morello LLVM to 15. The assertion does not trigger for RISC-V, but does for Morello since it tries to use NEON registers.

Should be uncontroversial since it just adds a && !Op.isMemset(). PR for CI.

Also pull in a diff from Morello to handle ISD::PTRADD in isMemSrcFromConstant() with a newly written test (not tested there).

Copying from a zero-constant can be optimized to a memset() and should
therefore not trigger the underaligned capability warnings. This is also
a baseline test for a crash found in the Morello backend where this
memcpy->memset optimization triggers an assertion in
diagnoseInefficientCheriMemOp().
Noticed while writing tests for copying capabilities from constants.
When a must_preserve_tags memcpy is converted to a memset, we may end up
using a non-capability MVT as the copy type. This change allow us to use
inline integer memset lowering for copies from zero constants that are
not necessarily sufficiently aligned. This also fixes an assertion
found while compiling ICU4C for Morello where a copy from a large zero
constant was lowered using NEON registers instead of capability ones.
@arichardson arichardson merged commit 0e82a82 into CTSRD-CHERI:dev Apr 30, 2024
7 checks passed
@arichardson arichardson deleted the capcopy-morello-assertion-fix branch April 30, 2024 22:59
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.

1 participant