[all-commits] [llvm/llvm-project] 4150a7: [SandboxVectorizer] Implement topdown vectorizer

Anshil Gandhi via All-commits all-commits at lists.llvm.org
Mon Jun 22 20:52:40 PDT 2026


  Branch: refs/heads/users/gandhi56/sandbox-vectorizer/topdown-vec
  Home:   https://github.com/llvm/llvm-project
  Commit: 4150a786d38a6cbb0383bd8fcedb9d5d17a2cc76
      https://github.com/llvm/llvm-project/commit/4150a786d38a6cbb0383bd8fcedb9d5d17a2cc76
  Author: Anshil Gandhi <gandhi21299 at gmail.com>
  Date:   2026-06-22 (Mon, 22 Jun 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
    A llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/TopDownVec.h
    A llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/VecPassBase.h
    M llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h
    M llvm/lib/Transforms/Vectorize/CMakeLists.txt
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/PassRegistry.def
    A llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/TopDownVec.cpp
    A llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/VecPassBase.cpp
    M llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.cpp
    M llvm/test/Transforms/SandboxVectorizer/external_uses.ll
    M llvm/test/Transforms/SandboxVectorizer/pack.ll
    A llvm/test/Transforms/SandboxVectorizer/topdown_vec.ll

  Log Message:
  -----------
  [SandboxVectorizer] Implement topdown vectorizer

This patch introduces the `top-down-vec` pass to the Sandbox Vectorizer,
adding the ability to traverse use-def chains top-down to discover and
collect vectorization opportunities.

Key changes include:
* TopDownVec Pass: Implemented `TopDownVec` which recursively processes
value bundles top-down, creates vectorization actions (widening, packing,
shuffles), and emits the final vector IR.
* Shared Infrastructure (VecPassBase): Extracted common IR emission logic
out of `BottomUpVec` and into a new shared base class, `VecPassBase`.
Functions for generating vector instructions, handling diamond reuse,
creating shuffles/packs, and collecting dead instructions are now shared
between the bottom-up and top-down vectorizers to prevent code
duplication.
* Pass Registration: Exposed `top-down-vec` in `PassRegistry.def` and
`SandboxVectorizerPassBuilder`, allowing it to be invoked within pass
pipelines via `opt`.
* Testing: Added comprehensive lit tests (such as `topdown_vec.ll`,
`pack.ll`, and `external_uses.ll`) to verify correct top-down traversal,
external use unpacking, and proper fallback to scalar packing.



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