[PATCH] D125335: Give option to use isCopyInstr to determine which MI is treated as Copy instruction in MCP

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 09:24:08 PDT 2022


adriantong1024 added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:89
+
+static cl::opt<bool> MCPUseCopyInstr("mcp-use-is-copy-instr", cl::init(false),
+                                     cl::Hidden);
----------------
lkail wrote:
> Why do we need this option? Can we extend MCP to check `TII.isCopyInstr` by default?
I've tried to use isCopyInstr by default, but there are cases which it does not work for some architecture. 

e.g. ARM
$lr = tMOVr killed $r1, 14, $noreg
tBX_RET 14, $noreg, implicit $r0

isCopyInstr sees tMOVr as a COPY instruction, but the use of $lr is not represented in tBX_RET, so the tMOVr is eliminated.

So far such problems have not been seen in AArch64.


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