[PATCH] D136793: [AArch64][GlobalISel] Add some minor post-selection optimizations.

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 16:14:36 PDT 2022


paquette added inline comments.


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp:94
+
+/// Look for cross regclass copies that can be trivially eliminated.
+bool AArch64PostSelectOptimize::foldSimpleCrossClassCopies(MachineInstr &MI) {
----------------
Doxygen comments should go in the header, right?


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp:108
+
+  if (!Src.isVirtual() || !Dst.isVirtual())
+    return false;
----------------
`isPhysical`?


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp:132
+    // This is the inverse case, where the destination class is a superclass of
+    // the source. Here, if the copy is the only user, we can just constrain
+    // the user of the copy to use the smaller class of the source.
----------------
We need the one-use check here right?


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp:150
+
+  for (unsigned Idx = 0; Idx < MI.getNumExplicitOperands(); ++Idx) {
+    auto &Op = MI.getOperand(Idx);
----------------
I think you can just use `explicit_operands()` here?


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp:156
+    Register Reg = Op.getReg();
+    if (!Reg.isVirtual() || !MRI.hasOneNonDBGUse(Reg))
+      continue;
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136793



More information about the llvm-commits mailing list