[all-commits] [llvm/llvm-project] 8bd3e0: [AMDGPU] Narrow provably-I32 address offsets

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Thu Oct 1 09:58:44 PDT 2026


  Branch: refs/heads/users/krzysz00/narrow-32bit-knownbits-ext-peeling
  Home:   https://github.com/llvm/llvm-project
  Commit: 8bd3e006c2d0b1bd1a890398d9517c69de6f4ac8
      https://github.com/llvm/llvm-project/commit/8bd3e006c2d0b1bd1a890398d9517c69de6f4ac8
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2026-10-01 (Thu, 01 Oct 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