This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] reorganize comments in getFrameIndexReference [nfc]
AbandonedPublic

Authored by reames on May 26 2022, 9:59 AM.

Details

Summary

Follow up to D126403. Reduce comment duplication, and give a high level description of what the code is doing.

For specific review attention, notice that the comment blocks being removed do not agree. In particular, they differ in the order of RVV Objects and scalar local variables. I believe the comment in the FP register path to have simply been wrong, do others agree?

Diff Detail

Event Timeline

reames created this revision.May 26 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 9:59 AM
reames requested review of this revision.May 26 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 9:59 AM
This revision is now accepted and ready to land.May 29 2022, 5:22 AM
Allen added a subscriber: Allen.May 29 2022, 9:21 AM
MaskRay accepted this revision.May 29 2022, 11:11 AM
frasercrmck requested changes to this revision.May 29 2022, 2:15 PM

No, I think the FP path is indeed different. The offsetting code lines up with the comment, doesn't it? That's what I gathered when working on this recently, anyway - I don't have the ability to verify it right now. I don't think it's correct to remove that comment wholesale. The only thing coming to me right now is a comment somewhere (code, commit - sorry) saying we want to put RVV objects as far away from the frame register as possible, hence the scalar/RVV swap when using FP. Or would that be better worded as "scalar as close to the frame register as possible"?

I do think we might be lacking RVV+FP testing. That was something I was going to look into.

This revision now requires changes to proceed.May 29 2022, 2:15 PM
reames planned changes to this revision.May 31 2022, 8:42 AM

No, I think the FP path is indeed different. The offsetting code lines up with the comment, doesn't it? That's what I gathered when working on this recently, anyway - I don't have the ability to verify it right now. I don't think it's correct to remove that comment wholesale. The only thing coming to me right now is a comment somewhere (code, commit - sorry) saying we want to put RVV objects as far away from the frame register as possible, hence the scalar/RVV swap when using FP. Or would that be better worded as "scalar as close to the frame register as possible"?

Thank you! Taking another much closer look here, I think you are correct. We do appear to actually change the relative order of the regions of the stack based on whether we have FP or not. That is "surprising" to say the least!

Thinking about it, I think this even vaguely makes sense. By doing it this way, we remove the need to include the variable-but-known size of the RVV region in the offset calculations for local objects.

I do worry about the implications for tooling of having the change in stack layout. Anyone know of anything that might break/complicate unpleasantly?

I do think we might be lacking RVV+FP testing. That was something I was going to look into.

I suspect this as well.

Will adjust this patch to incorporate the changed model.

reames abandoned this revision.Oct 24 2022, 9:43 AM

Closing review I'm not currently working on, and am unlikely to get back to in near future. Will reopen if priorities change.