Revert "Keep the old function order in CodeGenModule::applyReplacements."

This reverts commit r194357.

Debugging a cast failure during bootstrap.