[PATCH] D125335: Pass lamba to MachineCopyProp to determine which MI is treated as Copy instruction.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 15:49:10 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetMachine.cpp:781
+    addPass(createMachineCopyPropagationPass([](const MachineInstr &MI) {
+      const TargetInstrInfo *TII = MI.getMF()->getSubtarget().getInstrInfo();
+      return TII->isCopyInstr(MI);
----------------
This feels a bit heavy to do for each instruction. The subtarget lookup has to query a hash table. MachineCopyProp already has TII. Why can't it call a virtual method on TII that AArch64 implements and have a default implementation that does whatever the previous behavior was.

Or you could pass a bool to the MachineCopyPropagation that tells it to use TII->isCopyInstr() and default the bool to false for other targets.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125335



More information about the llvm-commits mailing list