[PATCH] D150438: [LLVM][Uniformity] Improve detection of uniform registers

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 04:31:25 PDT 2023


sameerds added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp:2879
+  // if available.
+  auto *RC = MRI.getRegClassOrNull(Reg);
+  if (!RC)
----------------
arsenm wrote:
> sameerds wrote:
> > arsenm wrote:
> > > Can combine these two queries into getRegClassOrRegBank
> > What's the advantage of that? The PointerUnion will simply conflate two different things for me, and the only improvement that I see is that I can check both for nullptr at the same time. After that, I still have to insert at least one ugly dyn_cast along with a full type name instead of auto just to get to the RegBank. Isn't the current version much more readable?
> It's one map lookup instead of 2. It also is really one thing, not two
Managed to just offload the decision to RegisterBankInfo::getRegBank(). It already handles all the corner cases, and now we treat it as the source of truth rather than duplicating that logic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150438



More information about the llvm-commits mailing list