[LLVMdev] Regarding BasicBlock Cloning

tarun agrawal tarun at cse.iitb.ac.in
Sat Apr 16 17:24:23 PDT 2011


Splitting the basic block might not work for me but I think DemotePHIToStack
will solve the problem..
Thanks for the reply.

Tarun

On Sun, Apr 17, 2011 at 5:45 AM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Sat, Apr 16, 2011 at 5:01 PM, tarun agrawal <tarun at cse.iitb.ac.in>
> wrote:
> > The clone llvm:CloneBasicBlock copies the phi function in the replicated
> > basic block from the original basic block.
> > 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.
>
> CloneBasicBlock isn't going to do anything magical... I pointed
> towards BasicBlock::splitBasicBlock because I figured you could split
> the PHIs out of the block you want to clone, or something like that.
> Using DemotePHIToStack on PHI nodes to eliminate them is another
> possibility.
>
> Trying to do optimizations without running mem2reg is a really bad
> idea for practical use: most optimization opportunities will be hidden
> behind loads and stores to allocas.
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110417/affec0ca/attachment.html>


More information about the llvm-dev mailing list