Loop unroller contains code that tries to update dominator tree on fly,
but eventually it calculates the tree from scratch for entire function.
If there are many loops in the function the compilation may be slow down.
Also inconsistent dominator info prevents from loop verification during
transformations.
This change implements incremental dominator tree update.
Part of this change (files Debug.h, LoopInfo.cpp and Dominators.cpp) is
independent from the rest of the patch, it implements changes required
to make testing of the dominator calculation.
Verifications of dominator tree and loop info are expensive operations
so they are disabled by default. They can be enabled by command line
options -verify-dom-info and -verify-loop-info. These options however
enable checks only in files Dominators.cpp and LoopInfo.cpp. If some
transformation changes dominaror tree and/or loop info, it would be
convenient to place similar checks to the files implementing the
transformation. By making corresponding flags global the verification
can be turned on optionally, even if expensive checks were not enabled
during build.
Why do you need the cast<Value>()?
Also, I'd a comment here that the reason VMap[IDom->getBlock()] is guaranteed to point to the right block is because the iteration order is RPO, so we've already made a copy of the IDom.