summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-01-09 19:08:22 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-01-09 19:08:22 +0000
commit771ec9f39939545d336209285d91640209b3d8c7 (patch)
treed9271530af784091c86ae1974d75aefeccb70611 /llvm/lib
parente9c278ccf1e89a5dbed4513950749a315181f11e (diff)
downloadbcm5719-llvm-771ec9f39939545d336209285d91640209b3d8c7.tar.gz
bcm5719-llvm-771ec9f39939545d336209285d91640209b3d8c7.zip
[COST]Fix PR35865: Fix cost model evaluation for shuffle on X86.
Summary: If the vector type is transformed to non-vector single type, the compile may crash trying to get vector information about non-vector type. Reviewers: RKSimon, spatel, mkuper, hfinkel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41862 llvm-svn: 322106
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86TargetTransformInfo.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 223eed3048d..967d67a84bc 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -754,7 +754,8 @@ int X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
// type remains the same.
if (Kind == TTI::SK_PermuteSingleSrc && LT.first != 1) {
MVT LegalVT = LT.second;
- if (LegalVT.getVectorElementType().getSizeInBits() ==
+ if (LegalVT.isVector() &&
+ LegalVT.getVectorElementType().getSizeInBits() ==
Tp->getVectorElementType()->getPrimitiveSizeInBits() &&
LegalVT.getVectorNumElements() < Tp->getVectorNumElements()) {
OpenPOWER on IntegriCloud