MemorySSA uses this algorithm. This moves the code around and changes the arguments so it can be reused in both places.
We don't have an SSAUtils.h or anything, but happy to put this wherever.
There are no actual algorithm or datastructure changes in here, just code movement.
Add a comment that says that Blocks must be valid for the whole lifetime of the IDFCalculator (or the next call to setDefiningBlocks).