[PATCH] Bug 20557 - bogus cpu parameter crashes llc
Oleg Ranevskyy
llvm.mail.list at gmail.com
Fri Aug 22 01:38:51 PDT 2014
Hi HaoLiu,
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//.
http://reviews.llvm.org/D5021
Files:
lib/CodeGen/TargetLoweringBase.cpp
Index: lib/CodeGen/TargetLoweringBase.cpp
===================================================================
--- lib/CodeGen/TargetLoweringBase.cpp
+++ lib/CodeGen/TargetLoweringBase.cpp
@@ -1179,8 +1179,11 @@
if (NVT == VT) {
// Type is already a power of 2. The default action is to split.
TransformToType[i] = MVT::Other;
- if (PreferredAction == TypeScalarizeVector)
+ if ( PreferredAction == TypeScalarizeVector
+ || VT.getVectorNumElements() == 1)
+ {
ValueTypeActions.setTypeAction(VT, TypeScalarizeVector);
+ }
else
ValueTypeActions.setTypeAction(VT, TypeSplitVector);
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5021.12834.patch
Type: text/x-patch
Size: 692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140822/c79568c2/attachment.bin>
More information about the llvm-commits
mailing list