[llvm] [DAG] Use getLegalMaskAndStepVector in expandGetActiveLaneMask (PR #226506)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 07:27:52 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag
Author: Luke Lau (lukel97)
<details>
<summary>Changes</summary>
Currently we will either use the mask vector type if it's big enough to fit the elements, or promote the element width to the scalar operand type.
In the latter case we will end up with a vector element type larger than strictly necessary, which means a v32i1 mask will get promoted to v32i64 on RISC-V, which isn't a legal type, and expansion fails.
We can use a legal vector type that's just small enough via getLegalMaskAndStepVector, which is already used by expandVectorFindLastActive, expandCttzElts etc. This fixes crashes on RISC-V and also uses a more compact step vector. It also means we can handle scalable vectors.
We need to move the function into TargetLowering.cpp to use the getLegalMaskAndStepVector, but this brings it inline with the other expansions.
---
Full diff: https://github.com/llvm/llvm-project/pull/226506.diff
4 Files Affected:
- (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+5)
- (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp (+1-43)
- (modified) llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp (+27)
- (modified) llvm/test/CodeGen/AArch64/neon-get-active-lane-mask.ll (+21-17)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226506
More information about the llvm-commits
mailing list