Not clearing was causing non-deterministic compiles for large files. Addresses
for MachineBasicBlocks would end up colliding and we would lay out a block that
we assumed had been pre-computed when it had not been.
LGTM. Also, this is clearly correct, feel free to land this simple of bug fix directly. =]
It'd be great if you can come up with a test with a pile of functions that will trigger this, but I understand why that might be hard. The assert seems likely enough.
Drive-by nit: Typically we like to have some text in the assert as well to explain why we're checking for such a thing, e.g. assert(BlockToChain.empty() && "Forgot to clear BlockToChain between functions!") or something.