[all-commits] [llvm/llvm-project] 8268a4: [SPIRV] Refactor implicit binding legalization

Helena Kotas via All-commits all-commits at lists.llvm.org
Wed Sep 9 11:05:14 PDT 2026


  Branch: refs/heads/users/hekota/pr221662-refactor-spirv-impl-binding-pass
  Home:   https://github.com/llvm/llvm-project
  Commit: 8268a49f564c746141d92f0ff4b7c8d878b6dea3
      https://github.com/llvm/llvm-project/commit/8268a49f564c746141d92f0ff4b7c8d878b6dea3
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2026-09-06 (Sun, 06 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVLegalizeImplicitBinding.cpp

  Log Message:
  -----------
  [SPIRV] Refactor implicit binding legalization

This change rewrites the `SPIRVLegalizeImplicitBinding` pass so that binding collection is driven by intrinsic declarations rather than a full-module instruction walk.

Previously, the pass used an `InstVisitor` to visit every instruction in the module and find calls to a small set of intrinsics. The new implementation iterates over the intrinsic declarations and their users, making the cost proportional to the number of relevant resource calls rather than the size of the module.

There is no change to the SPIR-V emitted for existing shaders. Implicit bindings are still assigned the same numbers.

Other improvements include:

- Order IDs are extracted once into a `SmallVector` instead of being recomputed on each sort comparisons.

- The separate `verifyUniqueOrderIdPerResource` walk is folded into the binding assignment loop.

- The two near-identical `replaceResourceHandleCall` / `replaceCounterHandleCall` helpers are merged shared code that differs only in intrinsic ID and argument list.

- Added a `HasImplicitBinding` flag for early exit and accurate `Changed` reporting, so a module with no implicit bindings (or with a declaration that has no users) now returns `PreservedAnalyses::all()` instead of unconditionally invalidating analyses.


  Commit: 659c5da49c8d7d3aaf09fd9f56164fd7e330e44f
      https://github.com/llvm/llvm-project/commit/659c5da49c8d7d3aaf09fd9f56164fd7e330e44f
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVLegalizeImplicitBinding.cpp

  Log Message:
  -----------
  Keep using separate functions to replace calls


  Commit: c651cab469aafd92510f15f294a36caeef577c6b
      https://github.com/llvm/llvm-project/commit/c651cab469aafd92510f15f294a36caeef577c6b
  Author: Helena Kotas <hekotas at microsoft.com>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVLegalizeImplicitBinding.cpp

  Log Message:
  -----------
  clang-format


Compare: https://github.com/llvm/llvm-project/compare/8268a49f564c%5E...c651cab469aa

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