[all-commits] [llvm/llvm-project] dabb0d: [MCP] Skip invalidating def constant regs during f...

Vladimir Radosavljevic via All-commits all-commits at lists.llvm.org
Thu Oct 10 07:06:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dabb0ddbd7a7229855156c61df1d35ad845361ac
      https://github.com/llvm/llvm-project/commit/dabb0ddbd7a7229855156c61df1d35ad845361ac
  Author: Vladimir Radosavljevic <129192835+vladimirradosavljevic at users.noreply.github.com>
  Date:   2024-10-10 (Thu, 10 Oct 2024)

  Changed paths:
    M llvm/lib/CodeGen/MachineCopyPropagation.cpp
    A llvm/test/CodeGen/AArch64/machine-cp-constant-reg.mir

  Log Message:
  -----------
  [MCP] Skip invalidating def constant regs during forward propagation (#111129)

Before this patch, redundant COPY couldn't be removed for the following
case:
```
  %reg1 = COPY %const-reg
  ... // There is a def of %const-reg
  %reg2 = COPY killed %reg1
```
where this can be optimized to:
```
  ... // There is a def of %const-reg
  %reg2 = COPY %const-reg
```

This patch allows for such optimization by not invalidating defined
constant registers. This is safe, as architectures like AArch64 and
RISCV replace a dead definition of a GPR with a zero constant register
for certain instructions.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list