[LLVMdev] Regarding BasicBlock Cloning
eli.friedman at gmail.com
Sat Apr 16 17:15:30 PDT 2011
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
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.
More information about the llvm-dev