move basicblock opt code to head of file