The insertion point cannot be set after the given command - instead, you must set it before the next instruction.
To get a pointer to the following statement, you can use the getNextNode() method, which is available on Instruction :
Builder.SetInsertPoint(I->getNextNode());
or you can rotate the instruction pointer into an iterator and advance it:
BasicBlock::iterator it(I); it++; Builder.SetInsertPoint(it);
source share