<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67933>67933</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `Mask.size() == TpNumElts && "Expected Mask and Tp size to match!"' failed, since "[SLP]Improve costs in computeExtractCost()"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
vectorization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mstorsjo
</td>
</tr>
</table>
<pre>
Since 019aee832768b0704048905cd8ce20299e7e0b25 (where the change was relanded) or the original 59a67ea35d608480257fc64ec3e5106ef50de740, the following snippet triggers failed asserts for the aarch64 targets:
```c
int b;
int *c;
void d(double *e, double *i, double *l) {
for (int f = 0; f < 3; f++)
for (int g = 0; g < 3; g++) {
e[f * 3 + g] = 0.;
for (int h = 0; h < 3; h++)
e[f * 3 + g] += i[f + h] * l[h * 3 + g];
}
}
void p() {
double j[] = {149.68500, 29.07000, 43.02765, 84.47235, 20.73466};
double k[] = {257.00392, 0.00000, 360.31950, 257.00392, 88.44438,
183.53583, 257.00392, 455.41095, 0.00000},
n[9], o[9];
double a = b / 255.;
double m[] = {a, a * b, a, a * b, b};
d(n, m, k);
d(o, j, n);
for (int f = 0; f < 9; f++)
c[f] = o[f];
}
```
Compiled like this:
```
$ clang -target aarch64-linux-gnu -c extract-reduced.c -O2 -funsafe-math-optimizations
clang: ../lib/Target/AArch64/AArch64TargetTransformInfo.cpp:3565: llvm::InstructionCost llvm::AArch64TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<const llvm::Value*>): Assertion `Mask.size() == TpNumElts && "Expected Mask and Tp size to match!"' failed.
```
CC @alexey-bataev
I'd like to revert this change if it takes long to fix.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.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