[all-commits] [llvm/llvm-project] 7c1b94: [SPIR-V] Fix some GEP legalization (#150943)

Nathan Gauër via All-commits all-commits at lists.llvm.org
Fri Aug 1 02:10:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c1b948e30b538803f79ac90c538e04f96470dd3
      https://github.com/llvm/llvm-project/commit/7c1b948e30b538803f79ac90c538e04f96470dd3
  Author: Nathan Gauër <brioche at google.com>
  Date:   2025-08-01 (Fri, 01 Aug 2025)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
    M llvm/test/CodeGen/SPIRV/llvm-intrinsics/lifetime.ll
    M llvm/test/CodeGen/SPIRV/logical-struct-access.ll
    A llvm/test/CodeGen/SPIRV/pointers/structured-buffer-access-constant-index-1.ll
    A llvm/test/CodeGen/SPIRV/pointers/structured-buffer-access-constant-index-2.ll
    A llvm/test/CodeGen/SPIRV/pointers/structured-buffer-access.ll

  Log Message:
  -----------
  [SPIR-V] Fix some GEP legalization (#150943)

Pointers and GEP are untyped. SPIR-V required structured OpAccessChain.
This means the backend will have to determine a good way to retrieve the
structured access from an untyped GEP. This is not a trivial problem,
and needs to be addressed to have a robust compiler.

The issue is other workstreams relies on the access chain deduction to
work. So we have 2 options:
 - pause all dependent work until we have a good chain deduction.
- submit this limited fix to we can work on both this and other features
in parallel.

Choice we want to make is #2: submitting this **knowing this is not a
good** fix. It only increase the number of patterns we can work with,
thus allowing others to continue working on other parts of the backend.

This patch as-is has many limitations:
- If cannot robustly determine the depth of the structured access from a
GEP. Fixing this would require looking ahead at the full GEP chain.
- It cannot always figure out the correct access indices, especially
with dynamic indices. This will require frontend collaboration.

Because we know this is a temporary hack, this patch only impacts the
logical SPIR-V target. Physical SPIR-V, which can rely on pointer cast
remains on the old method.

Related to #145002



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