diff options
author | Tim Renouf <tpr@botech.co.uk> | 2019-11-08 13:34:17 +0000 |
---|---|---|
committer | Tim Renouf <tpr@botech.co.uk> | 2019-11-08 15:40:09 +0000 |
commit | 0703db39892949ced56590a1ec8586bf20bffdb4 (patch) | |
tree | 082fe3bb8dd048124d5c9a4ce8667d77ab815dbc /llvm/lib/IR/Instructions.cpp | |
parent | a3db9c08ebdf1f39ed89f4a7afa09fc153cf98c5 (diff) | |
download | bcm5719-llvm-0703db39892949ced56590a1ec8586bf20bffdb4.tar.gz bcm5719-llvm-0703db39892949ced56590a1ec8586bf20bffdb4.zip |
[CostModel] Fixed isExtractSubvectorMask for undef index off end
ShuffleVectorInst::isExtractSubvectorMask, introduced in
[CostModel] Add SK_ExtractSubvector handling to getInstructionThroughput (PR39368)
erroneously thought that
%340 = shufflevector <4 x float> %339, <4 x float> undef, <3 x i32> <i32 2, i32 3, i32 undef>
is a subvector extract, even though it goes off the end of the parent
vector with the undef index. That then caused an assert in
BasicTTIImplBase::getExtractSubvectorOverhead.
This commit fixes that, by not considering the above a subvector
extract.
Differential Revision: https://reviews.llvm.org/D70005
Change-Id: I87b8b00b24bef19ffc9a1b82ef4eca3b8a246eaf
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 95521ad9121..9db6d87ba78 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2048,7 +2048,7 @@ bool ShuffleVectorInst::isExtractSubvectorMask(ArrayRef<int> Mask, SubIndex = Offset; } - if (0 <= SubIndex) { + if (0 <= SubIndex && SubIndex + (int)Mask.size() <= NumSrcElts) { Index = SubIndex; return true; } |