[llvm] [Scalarizer] Ensure valid VectorSplits for each struct element in `visitExtractValueInst` (PR #128538)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 09:47:01 PST 2025
================
@@ -1083,6 +1082,18 @@ bool ScalarizerVisitor::visitExtractValueInst(ExtractValueInst &EVI) {
std::optional<VectorSplit> VS = getVectorSplit(VecType);
if (!VS)
return false;
+ for (unsigned I = 1; I < OpTy->getNumContainedTypes(); I++) {
+ std::optional<VectorSplit> CurrVS =
+ getVectorSplit(cast<FixedVectorType>(OpTy->getContainedType(I)));
+ // It is possible for VectorSplit.NumPacked >= NumElems. If that happens a
+ // VectorSplit is not returned and we will bailout of handling this call.
+ // The secondary bailout case is if NumPacked does not match. This can
+ // happen if ScalarizeMinBits is not set to the default. This means with
+ // certain ScalarizeMinBits intrinsics like frexp will only scalarize when
+ // the struct elements have the same bitness.
+ if (!CurrVS || CurrVS->NumPacked != VS->NumPacked)
----------------
farzonl wrote:
So this works and I know its what I suggested in the ticket, but it seems like we are essentially just saying to Scalarize only if`ScalarizeMinBits` is 0.
I'm the person that added `if (!CurrVS || CurrVS->NumPacked != VS->NumPacked) return false;` to `splitCall` so essentially what I'm asking is if thats the right fix?
https://github.com/llvm/llvm-project/pull/128538
More information about the llvm-commits
mailing list