[PATCH] D147031: [MachineCopy] Enhance sub register machine copy propagation

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 04:04:04 PDT 2023


arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.
Herald added a subscriber: wdng.


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:427-433
+bool MachineCopyPropagation::hasSameRegClass(Register Def, Register Src) {
+  for (const TargetRegisterClass *RC : TRI->regclasses()) {
+    if (RC->contains(Def) && RC->contains(Src))
+      return true;
+  }
+  return false;
+}
----------------
You should be able to use existing, generated class relation queries 


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:558-560
+  if ((TRI->getRegSizeInBits(CopyDstReg, *MRI) !=
+       TRI->getRegSizeInBits(UseSrcReg, *MRI)) &&
+      !hasSameRegClass(CopyDstReg, CopySrcReg))
----------------
Shouldn't need to operate in terms of register sizes


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

https://reviews.llvm.org/D147031



More information about the llvm-commits mailing list