[LLVMdev] replacing instructions

Gordon Henriksen gordonhenriksen at me.com
Thu Jan 22 07:28:54 PST 2009


On 2009-01-22, at 10:02, Ralf Karrenberg wrote:

> is there any way to replace an instruction inside LLVM that is more  
> elegant than creating a new one, replacing uses and deleting the old  
> one if I only want to modify the type? It is generally not a big  
> deal, but the issue gets really messy if I am in the middle of  
> iterating over uses and start deleting some of them...


Hi Ralf,

There is not. LLVM Values are of immutable type. There is a method,  
Value::replaceAllUsesWith(), to do the replacement for you, however.

http://llvm.org/doxygen/classllvm_1_1Value.html#3ab5fc45117b450e8bb04e564cb6e5f2

— Gordon





More information about the llvm-dev mailing list