Running llc -verify-dom-info on the attached testcase results in a crash in the verifier, due to a stale dominator tree.
i.e.
DominatorTree is not up to date! Computed: =============================-------------------------------- Inorder Dominator Tree: [1] %safe_mod_func_uint8_t_u_u.exit.i.i.i {0,7} [2] %lor.lhs.false.i61.i.i.i {1,2} [2] %safe_mod_func_int8_t_s_s.exit.i.i.i {3,6} [3] %safe_div_func_int64_t_s_s.exit66.i.i.i {4,5} Actual: =============================-------------------------------- Inorder Dominator Tree: [1] %safe_mod_func_uint8_t_u_u.exit.i.i.i {0,9} [2] %lor.lhs.false.i61.i.i.i {1,2} [2] %safe_mod_func_int8_t_s_s.exit.i.i.i {3,8} [3] %safe_div_func_int64_t_s_s.exit66.i.i.i {4,5} [3] %safe_mod_func_int8_t_s_s.exit.i.i.i.lor.lhs.false.i61.i.i.i_crit_edge {6,7}
This is because in SelectionDAGIsel we split critical edges without updating the corresponding dominator for the function (and we claim in MachineFunctionPass::getAnalysisUsage() that the domtree is preserved).
We could either stop preserving the domtree in getAnalysisUsage or tell splitCriticalEdge() to update it.
As the second option is easy to implement, that's the one I chose.
Side note: not sure why this went unnoticed for so long.