> What about when we have a PHI, which we eliminate by inserting insns on > edges and those insns actually form a loop? You can see an example of > this in PR48389.
Interesting case, thanks. I think it's simply a matter of defining the API: does commit_edge_insertions need to fix up the CFG or is it the responsibility of the caller? Given that it cannot do so in CFG layout mode, I think that it makes sense not to do it in CFG RTL mode either. My testing apparently shows that only of one of the callers needs to be adjusted. Note that gimple_expand_cfg already knows that it must fix up the CFG, this won't change anything for it (and it doesn't call commit_edge_insertions). -- Eric Botcazou