[all-commits] [llvm/llvm-project] 82ec2d: [Coalescer] Consider NewMI's subreg index when upd...

Sander de Smalen via All-commits all-commits at lists.llvm.org
Tue Jan 7 07:06:27 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82ec2d6aa45fcfbfcf9f12504c10b1e457bda65c
      https://github.com/llvm/llvm-project/commit/82ec2d6aa45fcfbfcf9f12504c10b1e457bda65c
  Author: Sander de Smalen <sander.desmalen at arm.com>
  Date:   2025-01-07 (Tue, 07 Jan 2025)

  Changed paths:
    M llvm/lib/CodeGen/RegisterCoalescer.cpp
    M llvm/test/CodeGen/AArch64/register-coalesce-update-subranges-remat.mir

  Log Message:
  -----------
  [Coalescer] Consider NewMI's subreg index when updating lanemask. (#121780)

The code added in #116191 that updated the lanemasks for rematerialized
values checked if `DefMI`'s destination register had a subreg index.
This seems to have missed the following case:

```
  %0:gpr32 = MOVi32imm 1
  %1:gpr64 = SUBREG_TO_REG 0, %0:gpr32, %subreg.sub_32
```

which during rematerialization would have the following variables set:

```
  DefMI = %0:gpr32 = MOVi32imm 1

  NewMI = %3.sub_32:gpr64 = MOVi32imm 1   (rematerialized value)
```

When checking whether the lanemasks need to be generated, considering
whether DefMI's destination has a subreg index is insufficient, we
should look at DefMI's subreg index instead.

The added tests are a bit more involved, because I was not able to
reconstruct the issue without having some control flow in the test.
These tests come from actual reproducers.



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