[PATCH] D147031: [MachineCopy] Bug fix sub register machine copy propagation

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 01:05:22 PDT 2023


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: resistor, barannikov88, LuoYuanke, pengfei.
Herald added a subscriber: hiraditya.
Herald added a project: All.
xiangzhangllvm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The machine copy propagation logic has some problem:
When do machine copy propagation for subreg we need to consider the CopyDstReg and CopySrcReg's regclass and size.
(because we want to get SubReg from CopySrcReg by using SubregIdx which we got from CopyDstReg)
Take follow case for example:

  MCP: Replacing $ecx
       with $k0
       in renamable $k1 = COPY renamable $ecx
       from renamable $rcx = COPY renamable $k0, implicit-def $ecx

We can not use SubregIdx (ecx of rcx) to get anything from k0 register.


https://reviews.llvm.org/D147031

Files:
  llvm/lib/CodeGen/MachineCopyPropagation.cpp
  llvm/test/CodeGen/X86/machine-copy-subreg.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147031.508915.patch
Type: text/x-patch
Size: 15995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230328/5a55287f/attachment.bin>


More information about the llvm-commits mailing list