<div dir="ltr">Dear All,<div><br></div><div>It would be great if anyone help me out in finding a use case similar to the following example.</div><div><br></div><div>__attribute__((<span class="" id=":1ss.1" tabindex="-1" style="">noinline</span>))<br>int f (int p) {<br>    if (p == 10) {      // if-1<br>        return 0;<br>    }</div><div>    // Some statements here.<br>    return 2;<br>}<br><br>int g(int p) {<br>    return f(p);<br>}<br><div><br></div><div>Here, I would like to see if the compiler does a transformation, where the if statement (if-1) in the body of the function 'f' is removed from 'f' and pushed to the caller 'g' as follows. Please note that I have forced not to <span class="" id=":1ss.2" tabindex="-1" style="">inline</span> 'f'.</div><div><br></div><div>int f (int p) {</div><div>    

// Some statements here.<br>    return 2;<br>}<br><br>int g(int p) {</div><div>    if (p == 10) {      // if-1<br>        return 0;<br>    }<br>    return f(p);<br>}<br><div><br></div></div><div>This is a simple example that I used just to demonstrate the optimization (we may call it as function switching). If you know about any other use cases, where similar transformation happens, please let me know. When I generated the <span class="" id=":1ss.3" tabindex="-1" style="">llvm</span> IR (with -O3) such a transformation was not observed.</div><div><br></div><div>Regards,</div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span class="" id=":1ss.4" tabindex="-1" style="">Raghesh</span> <span class="" id=":1ss.5" tabindex="-1" style="">Aloor</span><br></div><div>PhD Scholar<br></div><div>PACE Lab, Dept. of <span class="" id=":1ss.6" tabindex="-1" style="">CSE</span>, <span class="" id=":1ss.7" tabindex="-1" style="">IIT</span> Madras<br><a href="http://www.cse.iitm.ac.in/~raghesh/" target="_blank">http://www.<span class="" id=":1ss.8" tabindex="-1" style="">cse</span>.<span class="" id=":1ss.9" tabindex="-1" style="">iitm</span>.ac.in/~<span class="" id=":1ss.10" tabindex="-1" style="">raghesh</span>/</a><br></div></div></div></div></div>