[all-commits] [llvm/llvm-project] cc5960: TwoAddressInstructions: Fix subranges straddling t...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue Sep 29 11:32:04 PDT 2026


  Branch: refs/heads/users/arsenm/codegen/twoaddr-insert-subreg-refine-subranges
  Home:   https://github.com/llvm/llvm-project
  Commit: cc59604debf34b64f7aefd72bef85c512411bcf8
      https://github.com/llvm/llvm-project/commit/cc59604debf34b64f7aefd72bef85c512411bcf8
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
    M llvm/test/CodeGen/PowerPC/dmr-enable.ll
    A llvm/test/CodeGen/RISCV/twoaddr-insert-subreg-subrange.mir
    M llvm/test/CodeGen/Thumb2/mve-vst2.ll
    M llvm/test/CodeGen/Thumb2/mve-vst3.ll

  Log Message:
  -----------
  TwoAddressInstructions: Fix subranges straddling the INSERT_SUBREG subreg index

When rewriting INSERT_SUBREG into a subregister COPY, the live interval
fixup only handled subranges entirely disjoint from the inserted subreg's
lane mask. A partially overlapping subrange keeps a value whose def no
longer writes all of its lanes, so those lanes lose their definition.

Refine the subranges against the subreg index first, while the def still
writes the whole register, so each one is either fully redefined by the
COPY or left untouched. This has to happen before the operands are
rewritten, or stripValuesNotDefiningMask drops the value for the
non-overlapping lanes.

Fixes a miscompile on RISC-V and restores the pre-6286f77214be output for
Thumb2/mve-vst2.ll, Thumb2/mve-vst3.ll and PowerPC/dmr-enable.ll.

Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>



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