basic blocks Originally applied in 72ce7599. Fixed a build failure caused by incorrect use of cast instead of dyn_cast. This reverts commit 8b0780f7.