[X86] isTargetShuffleEquivalent - assert the expected mask is correctly formed. NFCI.

While we don't make any assumptions about the actual mask, assert that the expected mask only contains valid mask element values.

llvm-svn: 366066
This commit is contained in:
Simon Pilgrim 2019-07-15 14:29:14 +00:00
parent 12400b9783
commit 60fb5e97a0
1 changed files with 2 additions and 0 deletions

View File

@ -10001,6 +10001,8 @@ static bool isTargetShuffleEquivalent(ArrayRef<int> Mask,
int Size = Mask.size(); int Size = Mask.size();
if (Size != (int)ExpectedMask.size()) if (Size != (int)ExpectedMask.size())
return false; return false;
assert(isUndefOrZeroOrInRange(ExpectedMask, 0, 2 * Size) &&
"Illegal target shuffle mask");
for (int i = 0; i < Size; ++i) for (int i = 0; i < Size; ++i)
if (Mask[i] == SM_SentinelUndef) if (Mask[i] == SM_SentinelUndef)