[LLVMdev] ReplaceInstWithInst appears to invalidate BB iterator?

Justin M. LaPre
Fri, 06 May 2011 23:30:51 -0000

Hello,

I have a call to ReplaceInstWithInst(Instruction *From, Instruction *To) inside
of a for loop iterating through a BasicBlock::iterator.  On the very next pass
after I replace the instruction, the iterator appears to be invalidated.  Is
this supposed to happen or am I doing something silly?  Is there a more
appropriate way to do this?  Thanks,

-Justin