scan basic blocks