-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
riscv64: Update Inst::worst_case_size
#8850
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Suggestion for a test but otherwise LGTM.
// | ||
// We also have a test case that tests some other instructions which have | ||
// the potential to generate a lot of bytes | ||
172 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's theoretically hard to enumerate all the different possible Inst
s and programmatically test the worst case -- but could we add a test at least that manually constructs what we think is the worst-case Inst
(return_call_indirect
with all clobbers set, etc) and asserts its size is 172? Size tests like this for large pseudoinsts plus a social norm of adding them for new large pseudoinsts will at least give partial coverage for this issue I think...
In retrospect this is my fault. The test case in #8847 uses Sorry about that, should have dug in a bit further myself! I naively assumed that the bug was in the zicond instructions added but in retrospect I see how that doesn't make sense |
👋 Hey,
This PR updates the
Inst::worst_case_size
size for the RISC-V backend. The panic that happens in #8847 is entirely due to thereturn_call_indirect
generating too many bytes.I found it difficult to add an automatic calculation of the worst possible size for that instruction to the test that we have, so I attempted to manually calculate the worst case size and used that.
The two test cases here are the original test case, and a minimized version without zicond. I'm not entirely sure why it bisects to the ZiCond PR (#8695), but having both test cases is not too much of a burden, so might as well.
The increased worst case size now causes an island to be emitted in the
return-call.clif
test, which are the changes for that test in this PR.