[PATCH] D108011: [MachineCopyPropagation] Check CrossCopyRegClass for cross-class copys

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 19:30:58 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:428
+  // instruction in later passes.
+  if (CopySrcRC != CrossCopyRC) {
+    const TargetRegisterClass *CopyDstRC =
----------------
I suspect you don't really want an exact class match, and probably should be checking if one is a subclass of the other


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp:806
+SIRegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
+  if (isAGPRClass(RC) && !ST.hasGFX90AInsts())
+    return getEquivalentVGPRClass(RC);
----------------
Should comment why this is done


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.h:111-114
+  /// Returns a legal register class to copy a register in the specified class
+  /// to or from. If it is possible to copy the register directly without using
+  /// a cross register class copy, return the specified RC. Returns NULL if it
+  /// is not possible to copy between two registers of the specified class.
----------------
I think copying the comment from the generic implementation just leads to documentation rot


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108011



More information about the llvm-commits mailing list