[PATCH] D125335: Pass lamba to MachineCopyProp to determine which MI is treated as Copy instruction.
Xin Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 21:52:58 PDT 2022
adriantong1024 added a comment.
Thanks for the review @craig.topper. I've updated the patch.
================
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);
----------------
craig.topper wrote:
> 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.
It seems getting subtarget is returning a pointer to STI.
https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/CodeGen/MachineFunction.h#L640
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