[PATCH] D150868: [CodeGen] Rename `MachineInstr::defs` to `MachineInstr::explicit_defs` (NFC)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 02:45:01 PDT 2023


foad added a comment.

In D150868#4355739 <https://reviews.llvm.org/D150868#4355739>, @barannikov88 wrote:

> In D150868#4355621 <https://reviews.llvm.org/D150868#4355621>, @foad wrote:
>
>> This makes a lot of sense to me.
>>
>>> It is more difficult to find an appropriate name for `uses`
>>
>> Agreed. Maybe the solution is to remove `uses`? How "useful" is it? Can we migrate to `operands` and/or `implicit_operands`?
>
> I tried, but it is not always obvious from the context what would be the correct change.
> I got the impression that you are familiar with AMDGPU (it is one of the main consumers of defs()/uses(), as the diff shows),
> so maybe you could handle this part?

Sure, I can help, but I can't promise how much time I can spend on it.

I see this sort of pattern a few times:

  for (auto &MO : I->uses()) {
    if (MO.isReg() && MO.isUse()) {
      MRI.clearKillFlags(MO.getReg());
    }
  }

Here we could really use a proper `uses` (or maybe `all_uses`) iterator that does the filtering for us, so it returns all use operands and //only// the use operands.

Do you think it would be worth renaming the current `uses` to something ugly like `uses_and_implicit_operands`, in the hope of migrating all users to something less ugly and then removing it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150868/new/

https://reviews.llvm.org/D150868



More information about the llvm-commits mailing list