<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59359>59359</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
RISC-V: Redundant VSETVLI
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jan-wassenberg
</td>
</tr>
</table>
<pre>
Per this [repro](https://gcc.godbolt.org/z/9Ysfs1KjP), calling vsetvlmax() once in several inlined functions results in several actual VSETVLI instructions. The expected result is a single VSETVLI at the start of the loop, or better yet, hoisted outside.
>From personal communication with Craig Topper, this seems to be caused by the intrinsic being marked as having side effects.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxckk1vtTgMhX9N2FgXQYBbWLDoxyBVM4uqrSrN0gQD6YQExea2nV__Ctr3cwOK43PyyD7IbCdP1KrqRlV3CW4yh9i-oj-9ITP5nuKU9GH4aB8ogsyWQVU3kdYYVHWndD2LrKyKa6U7pbvJmHQKQx-cpCFOSnf_K901__LI-d-vD0o3St-CQeesn-DCJBe34LvStdINBG8IrAemC0V0YL2zngYYN2_EBs8QiTcn_GsTGtnQwcvTX88v_9yD9Sxx-2xP4XkmoPeVjNDwJQbLgMDWT45-qFBAZgIWjAJhPA4uhHWnDRF6EqEIHyR7YQ6Wd7-wCduBUpXdqez689vFsMBKkYNHByYsy-atwR0H3qzMcBvRTvAc1pXibnaMlIkWBgnQExjcmAboPw4I6yVaz9ZAT_vIFoz_0QDIMONlL-wEQONIRvg3kmRoi6EpGkyozc9XWVFmeXOVzG1jhnLMscZzUxpTnZvGnHG86puxrrCoMbGtzrTOdXbOK13keTqYus9NX-rSlLWptCozWtC61LnLsu85scwbtVVTVE3isCfHR6K09vQGx6XSeg9YbHfNqd8mVmXmLAv_dBErjtrH-6fb04sqruGRhs0P6OX7npItuvaPxFmZtz41YVG6252-fqc1hlcyonR3vM9KdwfftwAAAP__Cvr6mg">