CloneBasicBlock doesn't change parent of cloned instructions

It seems the CloneBasicBlock function defined in Transforms/Utils/Cloning.h doesn't change the parent BasicBlock of the contained instructions when it has cloned them -- Is this a bug or a feature?


I'm not sure I understand. This code:

     Instruction *NewInst = II->clone();

Is enough to ensure that the 'Parent' field of NewInst points to NewBB. These links are automatically set when the instruction is inserted into the basic block (the push_back).


Chris Lattner wrote: