void removeRedundantBlocks(BlockPtr b) { StatementList& children = b->getChildren(); for (size_t i = 0; i < children.size(); ++i) { if (REN_DYNAMIC_CAST_PTR(ib, Block, children[i])) { removeRedundantBlocks(ib); StatementList sl = ib->getChildren(); children.erase(children.begin() + i); children.insert(children.begin() + i, sl.begin(), sl.end()); --i; } } }