[LLVMdev] Duplicating a Basic Block

Eli Friedman eli.friedman at gmail.com
Wed Jun 2 12:41:35 PDT 2010


On Wed, Jun 2, 2010 at 12:24 PM, ambika <ambika at cse.iitb.ac.in> wrote:
> Hi,
>
> I want to duplicate a set of basic blocks and finally modify the
> structure of CFG.
> But if I just duplicate a block then name of all the  temporaries will
> be same as in original block.
>
> So is there a way to rename all the temporaries in a basic block or I
> will have to do it instruction by instruction?

CloneBasicBlock in llvm/Transforms/Utils/Cloning.h should perform
cloning without having to worry about names.  In general, LLVM will
automatically rename an instruction if there is already an instruction
with the same name in a function.  How are you trying to duplicate the
block?

-Eli




More information about the llvm-dev mailing list