[PATCH] D108830: [AMDGPU] Propagate defining src reg for AGPR to AGPR Copys

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 12:23:12 PDT 2021


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/GCNPreRAOptimizations.cpp:161-162
 
+  for (MachineFunction::iterator BI = MF.begin(), BE = MF.end(); BI != BE;
+       ++BI) {
+    MachineBasicBlock *MBB = &*BI;
----------------
arsenm wrote:
> Since you're visiting all the defs anyway, could you unify this with the previous loop when an agpr register is found?
Second to that. We already scanning all registers in the processReg() and all their defs, so it shall not be hard to find a def of an AGPR which is a COPY.


================
Comment at: llvm/lib/Target/AMDGPU/GCNPreRAOptimizations.cpp:186
+        // Check if copy is AGPR to AGPR
+        bool IsAGPRDst = TRI->hasAGPRs(MRI->getRegClass(DstReg));
+        bool IsAGPRSrc = TRI->hasAGPRs(MRI->getRegClass(SrcReg));
----------------
It is better to use isAGPRClass() instead. AV classes may become allocatable one day [soon].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108830



More information about the llvm-commits mailing list