[all-commits] [llvm/llvm-project] 3d862c: [SPIRV] Add legalization for long vectors (#169665)

Steven Perron via All-commits all-commits at lists.llvm.org
Mon Dec 1 09:27:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d862cfcea9bba5fe04d22beaa6c46f850a76a73
      https://github.com/llvm/llvm-project/commit/3d862cfcea9bba5fe04d22beaa6c46f850a76a73
  Author: Steven Perron <stevenperron at google.com>
  Date:   2025-12-01 (Mon, 01 Dec 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
    M llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
    M llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
    M llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
    M llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.h
    A llvm/test/CodeGen/SPIRV/legalization/vector-legalization-kernel.ll
    A llvm/test/CodeGen/SPIRV/legalization/vector-legalization-shader.ll

  Log Message:
  -----------
  [SPIRV] Add legalization for long vectors (#169665)

This patch introduces the necessary infrastructure to legalize vector
operations on vectors that are longer than what the SPIR-V target
supports. For instance, shaders only support vectors up to 4 elements.

The legalization is done by splitting the long vectors into smaller
vectors of a legal size.

Specifically, this patch does the following:
- Introduces `vectorElementCountIsGreaterThan` and
  `vectorElementCountIsLessThanOrEqualTo` legality predicates.
- Adds legalization rules for `G_SHUFFLE_VECTOR`,
`G_EXTRACT_VECTOR_ELT`,
  `G_BUILD_VECTOR`, `G_CONCAT_VECTORS`, `G_SPLAT_VECTOR`, and
  `G_UNMERGE_VALUES`.
- Handles `G_BITCAST` of long vectors by converting them to
  `@llvm.spv.bitcast` intrinsics which are then legalized.
- Updates `selectUnmergeValues` to handle extraction of both scalars
  and vectors from a larger vector, using `OpCompositeExtract` and
  `OpVectorShuffle` respectively.

Fixes https://github.com/llvm/llvm-project/pull/165444



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