@@ -700,9 +700,9 @@ bool ScalarizerVisitor::isTriviallyScalarizable(Intrinsic::ID ID) {
700
700
// / element if possible for the intrinsic.
701
701
bool ScalarizerVisitor::splitCall (CallInst &CI) {
702
702
Type *CallType = CI.getType ();
703
- bool AreAllVectors = isStructOfMatchingFixedVectors (CallType);
703
+ bool AreAllMatchingVectors = isStructOfMatchingFixedVectors (CallType);
704
704
std::optional<VectorSplit> VS;
705
- if (AreAllVectors )
705
+ if (AreAllMatchingVectors )
706
706
VS = getVectorSplit (CallType->getContainedType (0 ));
707
707
else
708
708
VS = getVectorSplit (CallType);
@@ -730,12 +730,17 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
730
730
if (isVectorIntrinsicWithOverloadTypeAtArg (ID, -1 ))
731
731
Tys.push_back (VS->SplitTy );
732
732
733
- if (AreAllVectors ) {
733
+ if (AreAllMatchingVectors ) {
734
734
Type *PrevType = CallType->getContainedType (0 );
735
735
for (unsigned I = 1 ; I < CallType->getNumContainedTypes (); I++) {
736
736
Type *CurrType = cast<FixedVectorType>(CallType->getContainedType (I));
737
737
if (PrevType != CurrType) {
738
738
std::optional<VectorSplit> CurrVS = getVectorSplit (CurrType);
739
+ // This case does not seem to happen, but it is possible for
740
+ // VectorSplit.NumPacked >= NumElems. If that happens a VectorSplit
741
+ // is not returned and we will bailout of handling this call.
742
+ if (!CurrVS)
743
+ return false ;
739
744
Tys.push_back (CurrVS->SplitTy );
740
745
PrevType = CurrType;
741
746
}
0 commit comments