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

Add basic InstSimplify folds for CGetHigh and CSetFlags #697

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

arichardson
Copy link
Member

@arichardson arichardson commented May 17, 2023

Also some minor refactoring to allow sharing some code.
This somewhat regresses folding for CGetOffset but the existing fold was not safe.

@arichardson arichardson changed the title Add a basic InstSimplify folds for CGetHigh and CSetFlags Add basic InstSimplify folds for CGetHigh and CSetFlags May 17, 2023
@arichardson arichardson marked this pull request as draft May 17, 2023 17:10
@arichardson arichardson marked this pull request as ready for review June 8, 2023 17:45
Now that we depend on C++14, we can use switches in constexpr functions
and no longer need to pass two template parameters.
As part of this refactor some of the CHERI get intrinsics folding code.
This refactoring introduces a minor change to getoffset folding as well:
we no longer fold arbitrary getoffset(setoffset(A, B)) -> B since the
setoffset could have changed the bounds interpretation and therefore
also the result. This optimization is unlikely to make a difference in
practise and is somewhat incorrect so I believe dropping it makes sense.
If we are setting the same value we just read we can simplify the
sequence to just the original argument.
@arichardson
Copy link
Member Author

Rebased, should hopefully be safe to merge.

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