<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62126>62126</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LV] assume_safety option for pragma loop vectorize
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
erickq
</td>
</tr>
</table>
<pre>
I've had some problems with the assume_safety option for pragma loop vectorize recently, and I think the llvm implementation is inconsistent with the meaning of the option.
This option is `#pragma clang loop vectorize(assume_safety)`,According to https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150608/130619.html,Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking.
I read the llvm code, the analyzeLoop function of LoopAccessAnalysis.cpp, and if IsAnnotatedParallel is true, many checks are skipped, such as runtime pointer bounds checks.
![image](https://user-images.githubusercontent.com/12108571/231974298-ecd7ae85-8c70-4397-ab84-8c02e1d2e440.png)
![image](https://user-images.githubusercontent.com/12108571/231974349-fa51a36c-580f-4ba5-9079-e0321e36414d.png)
Is this part of the code implemented incorrectly?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VM2OrDYTfRqzsUDG_C9Y9Mx8SCPNJ0VKlCxHhV2A08Ymtpmrvk8fmWbupLO7i2yMcKnqHNc5VeC9mg1iT6onUr0ksIfFuh6dEte_ktHKW_9KePOBdAFJvV2Rbs6OGldPv6mw0LAgBe_3Fd89TBhu1G5BWUMn6-jmYF6Bams3-oEiWKe-I3Uo0AR9I_yZgpH0lYZFmetRSuuPlap107iiCXBUUp4qI6zxygc04Qt3RTDKzNROx-8dOCPshbDL_fxtUf6TkPKU1Izw4mQlNJj5X9wIbx8eQ3gXc_43kKdn0j5fhLBORshg6RLC5klxIXwgfNDKB59F-pl1M-HDpjZ0KyhN-CAmTI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