<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello!<div class=""><br class=""></div><div class="">I read a bunch of discussions about the matter on this very mailing-list that are relatively recent or relatively old and I couldn’t find much agreement on the matter, so … here again :D</div><div class=""><br class=""></div><div class="">LoopDeletion and infinite loops …</div><div class=""><br class=""></div><div class="">Currently LoopDeletion bails if non-detectable trip count loops are encountered and that’s fine, there are languages where infinite loops without side effects cannot be removed.</div><div class=""><br class=""></div><div class="">If I read the C++ spec right though <span style="font-family: LMRoman12; font-size: 12pt;" class="">N4527 (sec </span><span style="font-family: LMRoman10; font-size: 11pt; font-weight: 700;" class="">1.10) </span> point 27 says:</div><div class=""><span style="font-family: LMRoman7; vertical-align: 2pt;" class=""><br class=""></span></div><div class=""><font face="Menlo" style="font-size: 15px;" class=""><span style="vertical-align: 2pt;" class="">27  </span>The implementation may assume that any thread will eventually do one of the following: </font></div><div class=""><div class="page" title="Page 29"><div class="layoutArea"><div class="column"><ol start="25" style="list-style-type: none" class=""><li class=""><p class=""><font face="Menlo" class=""><span style="vertical-align: 2pt;" class="">27.1 </span>— terminate,</font></p>
                
        
        
                <div class="page" title="Page 29">
                        <div class="layoutArea">
                                <div class="column">
                
        
        
                <p class=""><font face="Menlo" class=""><span style="font-size: 10pt;" class="">27.2 — make a call to a library I/O function</span></font><br class=""></p><p class=""><font face="Menlo" class=""><span style="font-size: 10pt;" class="">
                
        
        
                </span></font></p><div class="page" title="Page 29">
                        <div class="layoutArea">
                                <div class="column">
                
        
        
                <p class=""><font face="Menlo" class=""><font size="2" class="">(27.3)— read or modify a volatile object, or</font> </font></p><div class="">
                
        
        
                <div class="page" title="Page 29">
                        <div class="layoutArea">
                                <div class="column">
                
        
        
                <p class=""><font face="Menlo" size="2" class="">(27.4)— perform a synchronization operation or an atomic operation.</font></p><p class=""><span style="font-family: Menlo; font-size: small;" class="">[</span><span style="font-family: Menlo; font-style: italic;" class="">Note: </span><span style="font-family: Menlo; font-size: small;" class="">This is intended to allow compiler transformations such as removal of empty loops, even when </span></p></div></div></div></div></div></div></div></div></div></div>
                                                </li>
                                        </ol>
                                </div>
                        </div>
                        <div class="layoutArea">
                                <div class="column"><p class="">
                
        
        
                </p><div class="page" title="Page 29">
                        <div class="layoutArea">
                                <div class="column"><p class=""><font size="2" class=""><font face="Menlo" class="">termination cannot be proven. <span style="font-style: italic;" class="">— end note </span></font><font face="Menlo" class="">]</font></font><br class="">
</p><p class=""><font size="2" class=""><font face="Menlo" class=""><br class=""></font></font></p><p class="">So, the spec seems to be explicitly calling out that removing infinite loops is ok unless they do any of the things mentioned there (at least that is my interpretation, is that correct?).</p><div class=""><br class=""></div><div class="">If that is the case we could be missing out for languages that have such a behavior (and in particular in C++).</div><div class=""><br class=""></div><div class="">I was wondering how it would be viewed the possibility of adding a flag to loop deletion that allows the removal of loops with loop counts that are not SCEVable.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Marcello</div>
                                </div>
                        </div>
                </div>
                                </div>
                        </div>
                </div></div></body></html>