<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sun, Apr 29, 2018 at 9:03 AM Madhur Amilkanthwar <<a href="mailto:madhur13490@gmail.com">madhur13490@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Is there any written description of what "non trivialness" is there?</div></blockquote><div><br></div><div>There is some in the comments in both old and new passes.</div><div><br></div><div>Short version is that a trivial unswitch does not require duplicating any part of the loop body. A non-trivial unswitch requires duplicating part of the loop body.</div><div><br></div><div>The reason for the term "trivial" is due the potential cost-model needed to decide whether the transform is a good idea. If no part of the loop body need to be duplicated, unswitching is considered "trivially" beneficial -- IOW, we always do it. But duplicating some part of the loop body has a code size hit at least, and may in some cases worsen performance (icache, etc.) so it is no longer trivial to decide.</div><div><br></div><div>LLVM only does "non-trivial" unswitching at O3 because of the risk of code size growth without any specific performance gains.</div><div><br></div><div>Also, the cost modeling for non-trivial loop unswitch remains an area of active development. In particular, there has been some work on the old unswitch pass that hasn't been ported to the new one and should be. There are also important differences between the old PM and the new PM here. The old PM's unswitch has a budget for non-trivial unswitching that is managed in a non-obvious way (IIRC, it is per-module, but i'd have to double check). The new PM doen't use this kind of budget. This makes it more risky for code size growth in some senses, but also makes it *much* more predictable overall. The old pass could be very hard to predict the behavior of where boring refactorings or code movement would dramatically change the budget and behavior.</div><div><br></div><div>-Chandler</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr">On Sun, Apr 29, 2018, 2:49 PM Chandler Carruth via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One of the last big missing pieces for the new PM is enabling non-trivial loop unswitch at O3.<div><br></div><div>The pass is now working well and passing all the testing I have done as well as some others' testing (thanks Fedor!) so it should be ready to be enabled.</div><div><br></div><div>I've done preliminary benchmarking on the test suite and SPEC and haven't seen any interesting regressions and quite a few improvements. Still, there may be some regressions out there. Not sure how many folks are using the new PM widely, but if you see regressions, don't hesitate to send a note my way.</div><div><br></div><div>Anyways, just wanted to send a heads-up. Not expecting this to be disruptive so will probably land it next week unless someone gives a shout.</div><div><br></div><div>-Chandler</div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div></div>