Don't keep flushing if there are no changes.
Don't keep flushing if there are no changes.

Summary:
Based on an observation by kugan and newobj in D20763355 -- `flush()` should be
cheap if there are no changes to commit, and right now, it will at least
iterate over all the instructions in the CFG which is not ideal.

This changes adds a test in the loop to stop iterating if there are no changes.
This covers the "empty"  case, but it also handles the case where we manage to
apply all the changes, because changes are removed from the map as they are
applied.

Reviewed By: NTillmann

Differential Revision: D20876501

fbshipit-source-id: 281e66869c71eef73b2f5c852c02e6bb3bfad1eb

facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex