[LLVMdev] whether these transformations are doable and how?

Eli Friedman eli.friedman at gmail.com
Wed Apr 14 19:51:53 PDT 2010


On Wed, Apr 14, 2010 at 5:45 PM, Neal  N. Wang <neal.wang at gmail.com> wrote:
> Thanks for all the replies which are really helpful.
>
> one more question regarding transformation:
>
> 4.  Given an instruction  %x1 = I1,  can I replace the rhs "I1"  with  "I2"
> and get a new instruction %x1 = I2?   Alternatively, I can add a new
> instruction %x2 = I2, and replace all uses of %x1 with %x2, and then delete
> %x1 = I1, but it seems the former is simpler or faster if it's doable.

Creating a new instruction, replacing all the uses, and deleting the
old instruction is the standard procedure; for various reasons, LLVM
doesn't allow editing certain aspects of an Instruction.

-Eli




More information about the llvm-dev mailing list