MachineBasicBlocks Cloning


For some schedulers like Trace Scheduling it is necessary to clone basic blocks.
Instinctively I would think the "Machine Instruction Scheduler" would be the right place to do so.

Is it possible to clone MachineBasicBlocks in the "Machine Instruction Scheduler" pass? Any snares? Or is it to much effort to implement it there and there is a better place for such things?

Thank you,

Cloning a basic block should be a utility function that can be called from any machine pass.

That being said, it should only be responsible for cloning the basic block and not updating any analysis passes that were run on the basic block. Those should have to be rerun separately.