[all-commits] [llvm/llvm-project] df1782: [MCP] Do not remove redundant copy for COPY from u...

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Fri Jun 9 05:24:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df1782c2a2af9938ba4c5bacfab20d1ddebc82dd
      https://github.com/llvm/llvm-project/commit/df1782c2a2af9938ba4c5bacfab20d1ddebc82dd
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2023-06-09 (Fri, 09 Jun 2023)

  Changed paths:
    M llvm/lib/CodeGen/MachineCopyPropagation.cpp
    M llvm/test/CodeGen/X86/machine-copy-prop.mir

  Log Message:
  -----------
  [MCP] Do not remove redundant copy for COPY from undef

I don't think we can safely remove the second COPY as redundant in such cases.
The first COPY (which has undef src) may be lowered to a KILL instruction instead, resulting in no COPY being emitted at all.

Testcase is X86 so it's in the same place as other testcases for this function, but this was initially spotted on AMDGPU with the following:
```
 renamable $vgpr24 = PRED_COPY undef renamable $vgpr25, implicit $exec
 renamable $vgpr24 = PRED_COPY killed renamable $vgpr25, implicit $exec
```
The second COPY waas removed as redundant, and the first one was lowered to a KILL (= removed too), causing $vgpr24 to not have $vgpr25's value.

Fixes SWDEV-401507

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152502




More information about the All-commits mailing list