Thanks John I will try it...<br><br>Tarun<br><br><div class="gmail_quote">On Sun, Apr 17, 2011 at 5:39 AM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</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 bgcolor="#ffffff" text="#000000"><div class="im">
On 4/16/11 7:01 PM, tarun agrawal wrote:
<blockquote type="cite">
The clone llvm:CloneBasicBlock copies the phi function in the
replicated basic block from the original basic block. <br>
</blockquote>
<br></div>
After you clone the basic block, you can probably replace the phi
instruction with another value of your choice. If you're adding
variables, you'll probably want to create them as allocas and use
loads and stores to access them. In such as case, you'd replace the
phi in the new BasicBlock with a load of your new variable.<br>
<br>
Once all your basic blocks are in place and all the terminator
instructions are modified so that your control-flow graph is the way
you want it to be, you can run mem2reg to change your alloca
variables into real SSA variables with phi-nodes in your new basic
blocks.<br>
<br>
-- John T.<br>
<br>
<br>
<blockquote type="cite"><div class="im">I don't want the copy of phi in relplicated block. For
now I am creating .bc file with -O0 option so that it doesn't
generate phi function in first place. Is this a good approach or
there are some other function available for it. <br>
<br>
Tarun<br>
<br>
<div class="gmail_quote">On Sun, Apr 17, 2011 at 5:22 AM, Eli
Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">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>
<div>On Sat, Apr 16, 2011 at 4:32 PM, tarun
agrawal <<a href="mailto:tarun@cse.iitb.ac.in" target="_blank">tarun@cse.iitb.ac.in</a>>
wrote:<br>
> Hi,<br>
><br>
> I am writing a pass for constant propagation using
graph restructuring (<br>
> code duplication). I am facing following
difficulties..<br>
><br>
> 1) I need to replicate the basic block but without
phi function in the<br>
> replicated block. How can I do this.<br>
><br>
> 2) I need to insert that basic block after and before
some particular basic<br>
> block.<br>
<br>
</div>
</div>
You probably want to use llvm::CloneBasicBlock from<br>
Transforms/Utils/Cloning.h to get a cloned version of a block.<br>
BasicBlock::splitBasicBlock might be useful as well.<br>
<font color="#888888"><br>
-Eli<br>
</font></blockquote>
</div>
<br>
</div><pre><fieldset></fieldset>
_______________________________________________
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>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br>