<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79229>79229</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash in SLPvectorizer on assertion "trying to erase instruction with users."
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:SLPVectorizer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
valerydmit
</td>
</tr>
</table>
<pre>
to reproduce:
opt -passes=slp-vectorizer -mcpu=x86-64-v3 -disable-output f.ll
[f.txt](https://github.com/llvm/llvm-project/files/14030909/f.txt)
f.ll attached as f.txt.
Fails after
```
commit ac254fc055980219b30821c3717c6b7db0fbbc46
Author: Alexey Bataev <a.bataev@outlook.com>
Date: Tue Apr 18 04:16:58 2023 -0700
[SLP]Improve tryToGatherExtractElements by using per-register analysis.
Currently tryToGatherExtractElements function analyzes the whole vector,
regrdless number of actual registers, used in this vector. It may
prevent some optimizations, because per-register analysis may allow to
simplify the final code by reusing more already emitted vectors and
better shuffles.
Differential Revision: https://reviews.llvm.org/D148855
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlE-PszYQxj-NcxkFGRsIHDhkN5vqlfaw6r7q3cAQ3BqMPOPssp--guy_VlWlV4rsYNk_zzN-ZgyRvUyItcjvRH7amciDD_XVOAxLN1reNb5bavYQcA6-iy0KfRTyJOTRzwz72RAhCX0iN--v2LIP9g0D7Md2jkKfXstiX2T7q4Z9Z8k0Dvc-8hwZ-sS5G0jkd33Cryzyk1DlwDzTeok6C3W-WB5ik7R-FOrs3PVj2s_B_4ktC3XurUMS6pxmUstKVuvShlPVO38b1_vAMJt2wA4MwbYp-b7lNp6NdQSmZwzwvl7I99_22fpxtAymVXnWtzLPq1KqtGq0LFXa6kN6aIvm0DWyb5o2K26HjltmhT7C0eErLnBn2OAVhL43SbP9F5n0kZ33f2169cPt5MnwmnQA-BkRjnOAtASZCX1MC6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