On 8/25/23 06:44, Li, Pan2 wrote:
Hi Jeff,
You might also peek at the RTL gcse/pre code which is also LCM based and
has the same class of problems.
I found a similar approach to take care of this in gcse.cc/pre_edge_insert with
some comments as below.
/* We can't insert anything on an abnormal and
critical edge, so we insert the insn at the end of
the previous block. There are several alternatives
detailed in Morgans book P277 (sec 10.5) for
handling this situation. This one is easiest for
now. */
if (eg->flags & EDGE_ABNORMAL)
insert_insn_end_basic_block (index_map[j], bb);
else
{
insn = process_insert_insn (index_map[j]);
insert_insn_on_edge (insn, eg);
}
It looks the insert_insn_end_basic_block is designed to handle the ABNORMAL
edge by inserting at end of previous block from the comments.
That's probably dead code at this point. IIRC rth did further work in
this space because inserting in the end of the block with the abnormal
edge isn't semantically correct.
It's been 20+ years, but IIRC he adjusted the PRE bitmaps so that we
never would need to do an insertion on an abnormal edge. Search for
EDGE_ABNORMAL in gcse.cc.
Jeff