EmitSchedule() shouldn't be touching instructions after the provided insertion point. The change introduced in D83561 performs a scan to the end of the block, and thus may move unrelated instructions. In particular, this ends up moving instructions that have been produced by FastISel and will later be deleted. Moving them means that more instructions than intended are removed.
Fix this by stopping the iteration when the insertion point is reached.
nit: most of those namespaces/enumerates should not be needed I think.