Splitting the basic block might not work for me but I think DemotePHIToStack will solve the problem.. <br>Thanks for the reply.<br><br>Tarun<br><br><div class="gmail_quote">On Sun, Apr 17, 2011 at 5:45 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Sat, Apr 16, 2011 at 5:01 PM, tarun agrawal <<a href="mailto:tarun@cse.iitb.ac.in">tarun@cse.iitb.ac.in</a>> wrote:<br>


> The clone llvm:CloneBasicBlock copies the phi function in the replicated<br>
> basic block from the original basic block.<br>
> I don't want the copy of phi in relplicated block. For now I am creating .bc<br>
> file with -O0 option so that it doesn't generate phi function in first<br>
> place. Is this a good approach or there are some other function available<br>
> for it.<br>
<br>
</div>CloneBasicBlock isn't going to do anything magical... I pointed<br>
towards BasicBlock::splitBasicBlock because I figured you could split<br>
the PHIs out of the block you want to clone, or something like that.<br>
Using DemotePHIToStack on PHI nodes to eliminate them is another<br>
possibility.<br>
<br>
Trying to do optimizations without running mem2reg is a really bad<br>
idea for practical use: most optimization opportunities will be hidden<br>
behind loads and stores to allocas.<br>
<font color="#888888"><br>
-Eli<br>
</font></blockquote></div><br>