Merge "Rewrite topological sort order and improve GVN." into lmp-dev