Hi Hao,
Would you be able to find some time and review this simple correction that we discussed previously, please?
Thank you.
Problem summary:
Regression caused by http://reviews.llvm.org/D4322.
Llc crashes when compiling the attached file if -march=aarch64 and -mcpu specifies a cpu that is invalid for this architecture.
The problem is with v1f32 type. According to AArch64TargetLowering::getPreferredVectorAction this vector type should be widened on aarch64.
If a bogus CPU is passed to llc, v2f32 is not added to the legal types list.
Because of that, v1f32 fails to be widened, so TargetLoweringBase::computeRegisterProperties() falls through to the next switch-case branch, which sets the preferred type action to TypeSplitVector. This means we are trying to split one element vector. This triggers the assert in VectorType::get. The same applies to other 1-sized vector types listed in getPreferredVectorAction: v1i8, v1i16 and v1i32.
Fix summary:
If the preferred action for a one element vector is neither TypeSplitVector nor TypeScalarizeVector and it fails to be applied, then the action is set to TypeScalarizeVector instead of TypeSplitVector.