what's the best way to insert an instruction after the current instruction

The current instruction is:

Instruction *pInst;

How can I create a new instruction, say add, after pInst?


IRBuilder takes an insertion point.
Use it?

Does the insert point also mean inserting before the instruction?

So if you want the instruction after it, increase the iterator by 1.
If Iterator + 1 was after BB->end() you had a bug anyway unless you
were replacing the terminator :slight_smile:

I see. Thanks.