Clean-up the width computing logic given a memory operand, and re-arrange code to avoid
code duplication.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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 |
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? |
Have taken care of second review comment by Matt, and first one, I think is not necessary to take care.
llvm/lib/Target/AMDGPU/SIInstrInfo.h | ||
---|---|---|
839 | Anyway, second comment is taken care, first one, I think is not necessary. |
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). |
Losing the units in the name is a regression. I would also pass in MRI explicitly rather than getting it from the parent function