I've tried to see what is going on according to your explanation for
this issue.
In that PR, the basic blocks before try_optimize_cfg look like the left
side of the following figure and try_optimize_cfg combines two blocks
into one block
+-----------+
| ... |
| call insn |
+-----------+
| ... \
fall | ... \ abnormal
| ... \
| ... \
V
+-----------+
b: | val. copy |
+-----------+ +-----------+
| combine b&c | val. copy |
| jump -> | ... |
V | |
c: +-----------+ +-----------+
| ... |
+-----------+
Then the first scheduling pass produces a sequence which will fail in
reload because the register pressure is too high in the combined BB,
right?
As an experiment, I've ruled out the above situation with
edge e = NULL;
if (single_pred_p (b)
&& (single_pred_edge (b)->flags & EDGE_FALLTHRU))
{
edge_iterator ei;
basic_block d = single_pred_edge (b)->src;
FOR_EACH_EDGE (e, ei, d->succs)
if (e->flags & EDGE_COMPLEX)
break;
}
if (e)
and made the above combining not to happen in try_optimize_cfg. It
gets rid of the ICE, though I'm not sure that it's the Right Thing
even for SH-4.