[all-commits] [llvm/llvm-project] 4a358b: [SPIR-V] Fix wrong element inferred for long vecto...

Farzon Lotfi via All-commits all-commits at lists.llvm.org
Mon Sep 21 20:00:31 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a358b89216a4fa56b08355d2b00f694657f64ba
      https://github.com/llvm/llvm-project/commit/4a358b89216a4fa56b08355d2b00f694657f64ba
  Author: Farzon Lotfi <farzonlotfi at microsoft.com>
  Date:   2026-09-21 (Mon, 21 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVLegalizePointerCast.cpp
    M llvm/test/CodeGen/SPIRV/passes/SPIRVLegalizePointerCast.ll
    A llvm/test/CodeGen/SPIRV/pointers/byte-address-buffer-long-vector.ll

  Log Message:
  -----------
  [SPIR-V] Fix wrong element inferred for long vectors when using ByteAdressBuffer (#222220)

fixes #222214

On the offload tests we recently switch the long vector tests from using
StructuredBuffer element loads and stores to ByteAddressBuffer vector
loads and stores With StructuredBuffer you can see we use the right type
for the vector https://hlsl.godbolt.org/z/jYhd57jvn

However with ByteAddressBuffer instead of a float vector we are infering
incorrectly an int vector https://hlsl.godbolt.org/z/KMnxfv8z6

The Fix is to use spv_bitcast instead of an llvm ir bitcast. An ordinary
LLVM bitcast i32 to float becomes a same-size GlobalISel operation. Both
i32 and float use the same low-level type, s32, so
legalization/coalescing can eliminate the bitcast. switching to
spv_bitcast solves this because it forces a `buildAssignType` which will
preserve the type and allows us to distinguish ints from floats.



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