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

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


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3db7fe43c223144d4667a78444cc01901e5b9da
      https://github.com/llvm/llvm-project/commit/a3db7fe43c223144d4667a78444cc01901e5b9da
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
    A llvm/test/CodeGen/AMDGPU/twoaddr-insert-subreg-subrange.mir
    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 (#227427)

Rewriting INSERT_SUBREG into a subregister COPY narrows the def from the
whole register down to one subreg index. The live interval fixup for that only 
handled subranges entirely disjoint from the inserted lane mask, so a partially 
overlapping subrange keeps a value whose def no longer writes all of its lanes.
    
The stale value makes the lanes outside the inserted subregister look
defined by the COPY, so the copy that actually provides them ends up
dead and its value is lost. Refine the subranges against the subreg index
before narrowing the def, leaving each one either fully redefined by the COPY
or untouched by it.
    
Fixes a miscompile reported on RISC-V and restores the pre-6286f77214be
output of 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