This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU/MemOpsCluster] Code clean-up around accessing of memory operand width
ClosedPublic

Authored by hsmhsm on Jun 1 2020, 12:11 PM.

Details

Summary

Clean-up the width computing logic given a memory operand, and re-arrange code to avoid
code duplication.

Diff Detail

Event Timeline

hsmhsm created this revision.Jun 1 2020, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2020, 12:11 PM
arsenm added inline comments.Jun 1 2020, 3:01 PM
llvm/lib/Target/AMDGPU/SIInstrInfo.h
839

Losing the units in the name is a regression. I would also pass in MRI explicitly rather than getting it from the parent function

hsmhsm marked an inline comment as done.Jun 1 2020, 7:06 PM
hsmhsm added inline comments.
llvm/lib/Target/AMDGPU/SIInstrInfo.h
839

The function getOperandSizeInBytes() is not something existing for quite some time, It was just added by me in my previous patch https://reviews.llvm.org/D80545. Then, I saw few already existing functions with the name getOpSize to get operand size in bytes (see ones just above this function). So, I favored uniformity here, and added another required overloaded function here. In that since it is not a regression.

If we do not get MRI from the parent here, then, caller of the getOpSize() has to do it. Is not it good to get it one place rather calling getParents repeatedly from caller side in multiple places?

hsmhsm updated this revision to Diff 267780.Jun 1 2020, 8:28 PM

Have taken care of second review comment by Matt, and first one, I think is not necessary to take care.

hsmhsm marked an inline comment as done.Jun 1 2020, 8:29 PM
hsmhsm added inline comments.
llvm/lib/Target/AMDGPU/SIInstrInfo.h
839

Anyway, second comment is taken care, first one, I think is not necessary.

foad added inline comments.Jun 2 2020, 8:07 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
276–277

MO is not a very descriptive name. How about DataOp (or DataOpIdx when you switch to using getNamedOperandIdx)?

llvm/lib/Target/AMDGPU/SIInstrInfo.h
839

There's no need for this new overload if you use getNamedOperandIdx instead of getNamedOperand and pass the index into getOpSize(MI, OpNo).

hsmhsm updated this revision to Diff 267925.Jun 2 2020, 10:19 AM

Have taken care of review comments by Jay.

foad accepted this revision.Jun 3 2020, 1:20 AM
This revision is now accepted and ready to land.Jun 3 2020, 1:20 AM
This revision was automatically updated to reflect the committed changes.