[LLVMdev] replace instruction

Nick Lewycky nicholas at mxc.ca
Fri Jul 16 23:45:03 PDT 2010

Chayan Sarkar wrote:
> Hello all,
> Suppose I have an Instruction like
> %1 = add i32 %a, %b
> and I want to convert it like
> %t = add i32 %a, %b

This is not an assignment, that is a common misunderstanding. There is 
no register being assigned to the result of the add. The format is 
"%<name of instruction> = <instruction>". If you want your instruction 
to have the name "t" then call MyAddInst->setName("t");

> and assign the value of %t to %1 (something like %1<- %t )

There is no copy instruction in LLVM. You can fake it with bitcast but 
you should never need to do that.


> how can I accomplish this?
> Regards,
> Chayan
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list