[llvm] [SLPVectorizer][AMDGPU] Look-through vectorization of AMDGPU intrinsics (PR #175821)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 03:47:51 PDT 2026


alexey-bataev wrote:

The problem with this approach is that it enables vectorization of the non-proftiable subtrees.
Generally speaking, you are proposing something like `<user subtree>-><passthrough node>-><operand subtree>` structure. Here we have 4 potential combinations of subtrees:
1. both `<user subtree>` and `<operand subtree>` are profitable for the vectorization.
2. both `<user subtree>` and `<operand subtree>` are not profitable for the vectorization.
3. `<user subtree>` is profitable, `<operand subtree>` is not profitable for the vectorization.
4. `<user subtree>` is non-profitable, `<operand subtree>` is profitable for the vectorization.

First 2 cases are ok. The third is fine too, the non-profitable `<operand subtree>` will be removed during tree trimming. But there is a problem with the 4th case. If it makes the whole tree non-profitable for the vectorization, we're missing vectorization of the profitable `<operand subtree>`. If the whole tree is profitable for vectorization, you will vectorize both non-profitable and profitable parts of the tree, leading to not the best vectorization result. In this case, the `<user subtree>` should remain scalar, but with the passthrough node approach, it cannot be skipped. That's why such nodes should be scalarized explicitly.

https://github.com/llvm/llvm-project/pull/175821


More information about the llvm-commits mailing list