Thanks for your explanation and advice. It is very useful for me.<div><br></div><div>--Cuong</div><div><br><div class="gmail_quote">On Tue, Jun 14, 2011 at 10:38 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Cuong,<br>
<div class="im"><br>
> I am trying to avoid using stack memory (or mutable variable is the term<br>
> used in the tutorial). I am also trying to optimize the code as much as I<br>
> can before using optimizer passes such as mem2reg (to reduce the compile<br>
> time as well).<br>
<br>
</div>I don't think there is much point in avoiding stack variables (using them<br>
makes your life much simpler -> easier to have your front-end be correct;<br>
passes like mem2reg will turn your variables into registers if possible<br>
anyway).  And there's also not much point in trying to keep the bitcode small<br>
so as to speed up the optimizers: it will just make your front-end more<br>
complicated, while probably the gains (if any) are insignificant.  My advice<br>
is to keep your front-end as simple as possible.  You can run some per-function<br>
passes as you output each function, to clean it up and reduce the bitcode size,<br>
for example simplifycfg+scalarrepl+instcombine, if memory usage is a problem.<br>
<div><div></div><div class="h5"><br>
Ciao, Duncan.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>