[llvm] [TargetLowering] Prevent expandVectorFindLastActive from creating illegal vector types during vector op legalization. (PR #190914)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 00:12:27 PDT 2026
================
@@ -10139,6 +10145,44 @@ SDValue TargetLowering::expandVectorFindLastActive(SDNode *N,
SDLoc DL(N);
auto [Mask, StepVec] = getLegalMaskAndStepVector(
N->getOperand(0), /*ZeroIsPoison=*/true, DL, DAG);
+
+ // If StepVec is empty, the stepvector would require splitting.
+ // Split the operation instead and let it be recursively legalized.
+ if (!StepVec) {
+ EVT MaskVT = N->getOperand(0).getValueType();
+ EVT ResVT = N->getValueType(0);
+
+ // Split the mask
+ auto [LoVT, HiVT] = DAG.GetSplitDestVTs(MaskVT);
+ std::pair<SDValue, SDValue> SplitMask =
+ DAG.SplitVector(N->getOperand(0), DL);
+ SDValue MaskLo = SplitMask.first;
+ SDValue MaskHi = SplitMask.second;
----------------
lukel97 wrote:
Use destructuring?
```suggestion
auto [MaskLo, MaskHi] = DAG.SplitVector(N->getOperand(0), DL);
```
https://github.com/llvm/llvm-project/pull/190914
More information about the llvm-commits
mailing list