We currently assume that pseudo expansion doesn't increase the distance between a branch and it's label. This patch adds some asserts to catch violations of this property in pseudo expansion.
I chose to only do the assertion at the function level as we have to scan the whole function for size changes (since expansion can create multiple blocks). We could cache individual block sizes, and thus make the check cheap enough to do after every expansion, but that requires more complex code.
It also looks like we have some shared code structure here. If reviewers want, I'm happy to factor out a base class for pseudo expansion, and add the asserts there. I'm not sure this is worth doing, but will happily defer to reviewer preference.
Will this warn in release builds? Should we put #ifndef NDEBUG around the loops?