[all-commits] [llvm/llvm-project] 61ce43: [AMDGPU] Narrow provably-I32 address offsets

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Fri Sep 18 18:55:29 PDT 2026


  Branch: refs/heads/users/krzysz00/narrow-32bit-knownbits-ext-peeling
  Home:   https://github.com/llvm/llvm-project
  Commit: 61ce430a79fd4a75626a233a8f2b9963d1c441f4
      https://github.com/llvm/llvm-project/commit/61ce430a79fd4a75626a233a8f2b9963d1c441f4
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2026-09-19 (Sat, 19 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
    M llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.i8.ll
    M llvm/test/CodeGen/AMDGPU/ctlz.ll
    M llvm/test/CodeGen/AMDGPU/ctlz_zero_poison.ll
    M llvm/test/CodeGen/AMDGPU/cttz.ll
    M llvm/test/CodeGen/AMDGPU/global-saddr-narrow-offset.ll
    M llvm/test/CodeGen/AMDGPU/memory-legalizer-global-lastuse.ll
    M llvm/test/CodeGen/AMDGPU/memory-legalizer-global-nontemporal.ll
    M llvm/test/CodeGen/AMDGPU/memory-legalizer-global-volatile.ll
    M llvm/test/CodeGen/AMDGPU/promote-constOffset-to-imm.ll
    M llvm/test/CodeGen/AMDGPU/rewrite-vgpr-mfma-to-agpr.ll
    M llvm/test/CodeGen/AMDGPU/smfmac_alloc_failure_no_agpr_O0.ll
    M llvm/test/CodeGen/AMDGPU/smrd-narrow-soffset.ll
    M llvm/test/CodeGen/AMDGPU/vgpr-liverange-ir.ll

  Log Message:
  -----------
  [AMDGPU] Narrow provably-I32 address offsets

Add a `tryNarrowToI32()` function that uses KnowsBits to detect 64-bit
offests that could be in a 32-bit register, allowing us to match
base + offset cases that don't involve literal base + (ext offset)
nodes.

Apply this to global_* instructions and the scalar memory instructions
that take a scalar offset.

This does leave a few dead copies when we have to bail out of the SMEM
handling for creatining a negative offset, but those don't have
end-to-end effect and it looks like you could already get dead MOVs
from that codepath.

AI disclosure: Claude wrote the code, I looked at it.



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