[LLVMdev] Regarding BasicBlock Cloning

Eli Friedman eli.friedman at gmail.com
Sat Apr 16 16:52:26 PDT 2011


On Sat, Apr 16, 2011 at 4:32 PM, tarun agrawal <tarun at cse.iitb.ac.in> wrote:
> Hi,
>
> I am writing a pass for constant propagation using graph restructuring (
> code duplication). I am facing following difficulties..
>
> 1) I need to replicate the basic block but without phi function in the
> replicated block. How can I do this.
>
> 2) I need to insert that basic block after and before some particular basic
> block.

You probably want to use llvm::CloneBasicBlock from
Transforms/Utils/Cloning.h to get a cloned version of a block.
BasicBlock::splitBasicBlock might be useful as well.

-Eli



More information about the llvm-dev mailing list