<div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>Should this doc be updated accordingly: <a href="https://llvm.org/docs/Frontend/PerformanceTips.html">https://llvm.org/docs/Frontend/PerformanceTips.html</a> ?</div><div><br></div><div>Thanks!</div><div><br></div><div>-- </div><div>Mehdi</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 25, 2021 at 2:23 AM Florian Hahn via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hi,<div><br></div><div>Just a quick heads up. Recently a few changes landed that updated code in LLVM that implicitly assumed some functions will return. Now, the code explicitly checks for the `willreturn` attribute. Please see the patches below</div><div><a href="https://reviews.llvm.org/rG292077072ec1" target="_blank">https://reviews.llvm.org/rG292077072ec1</a></div><div></div><div><a href="https://reviews.llvm.org/rG5d12b976b004" target="_blank">https://reviews.llvm.org/rG5d12b976b004</a></div><div><br></div><div>Among other things, this means LLVM now won’t remove function calls to readonly functions, unless they are willreturn. This fixes some longstanding issues for languages without C++-like forward-progress guarantees (see <a href="https://bugs.llvm.org/show_bug.cgi?id=965" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=965</a> )</div><div><br></div><div> For the simple example below, LLVM now won’t remove the call to loop(), if it is compiled as a C program.</div><div><br></div><div><div>void loop() {</div><div><span style="white-space:pre-wrap"> </span>while(1);</div><div>}</div><div>int main() {</div><div><span style="white-space:pre-wrap">     </span>loop();</div><div><span style="white-space:pre-wrap">  </span>return 1;</div><div>}</div></div><div><br></div><div><br></div><div>If your frontend provides C++-like forward progress guarantees, please make sure functions/loops are marked as `mustprogress` accordingly. Mustprogress helps with inferring `willlreturn`.</div><div><br></div><div>If your frontend can guarantee a function will always return, consider adding the `willreturn` attribute to the generated functions.</div><div><br></div><div>Please audit the intrinsics definitions for your target. They also need to be marked as willreturn, if possible.As an example, see the patch that updated AArch64 <a href="https://reviews.llvm.org/rG50ae6a3ac9bd" target="_blank">https://reviews.llvm.org/rG50ae6a3ac9bd</a> . At the moment, the code still (wrongly) assumes that all intrinsics will return. Once people had time to update their backends, the plan is to remove this assumption.</div><div><br></div><div>Cheers,</div><div>Florian</div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>