<div dir="ltr">OK, Let me describe. There is nothing wrong with if-conversion in LLVM. The algorithm implemented in LLVM can handle the if(???){do something} and if(???){do something}else{do something else} case very well. But it can handle complicated case like when there are a lot of gotos in the program. The more systematic way to do if-conversion is based on Hyperblock <a href="http://www.eecs.umich.edu/eecs/about/articles/2015/p45-mahlke.pdf">[Scott A. Mahlke et al 1992]</a>, which is set of basic blocks with one entrance and one or more exits. The algorithms now implemented in LLVM is very easy to understand, and very easy to implement. But it is not general, and it might not generate code with best efficient.<div><br></div><div>As we know, if-conversion is a double-edged sword, it might increase the efficiency, it might also make it worse. For example, if the program to be compiled have a code like:</div><div>if (<a>) {</div><div>   execute 1000 statements</div><div>} else {</div><div>   execute 1 statements</div><div>}</div><div>In the case when <a> is almost always true, it is very efficient because it avoid branching with only executing one more statement as punishment. The improvements of performance from eliminating the branching is always larger than 1 cpu cycle. However, in the case when <a> is almost always false, doing if-conversion is a stupid decision because the improvements of eliminating the branch is very limited here, but the punish, that 1000 more statements have to be executed everytime, really hurt.</div><div><br></div><div>There are studies on how to make a balance in whether to do if-conversion or not. There are both static policy <a href="http://impact.crhc.illinois.edu/shared/papers/micro-97-framework.pdf">[David I. August et al 1997]</a> and dynamic policy <a href="http://www.cs.virginia.edu/kim/docs/pact00.pdf">[Kim M. Hazelwood and Thomas Conte 2000]</a>. What I want to do for GSoC is to implement these approaches into LLVM.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Xiang Gao</div></div>
<br><div class="gmail_quote">2015-03-17 18:14 GMT-04:00 John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Dear Xiang,<br>
      <br>
      Can you briefly describe the limitations with the current
      if-conversion in LLVM and how you plan to improve it?  I haven't
      read your thesis, and I (and others) are unlikely to have time to
      do so.<br>
      <br>
      Regards,<br>
      <br>
      John Criswell<div><div class="h5"><br>
      <br>
      On 3/16/15 4:23 PM, Xiang Gao wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>Are you guys interested in implementing if-conversion as a
          GSoC 2015 project? Last year, I did a literature review about
          approaches of if-conversion and the if-conversion in LLVM.
          This was the undergraduate thesis of my bachelor degree. It
          seems that, the if-conversion used in LLVM is a very simple
          approach instead of following the literature. So I want to
          implement the approaches in the literature in LLVM and get
          support from Google for this. Are you guys interested?</div>
        <div><br>
        </div>
        <div>Best,</div>
        <div><br>
          <div>
            <div>Xiang Gao</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <br>
    <pre cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
  </font></span></div>

</blockquote></div><br></div>