@@ -3431,7 +3431,9 @@ process_insert_insn (struct expr *expr)
For PRE, we want to verify that the expr is either transparent
or locally anticipatable in the target block. This check makes
- no sense for code hoisting. */
+ no sense for code hoisting.
+ ??? We always call this function with (PRE == 0), which makes the checks
+ useless. */
insert_insn_end_basic_block (struct expr *expr, basic_block bb, int pre)
@@ -3535,6 +3537,9 @@ insert_insn_end_basic_block (struct expr *expr, basic_block bb, int pre)
new_insn = emit_insn_after_noloc (pat, insn, bb);
+ /* ??? It maybe useful to try set REG_EQUAL note on NEW_INSN here.
+ How can we do it? */
if (INSN_P (pat))
@@ -4343,7 +4348,16 @@ hoist_code (void)
index_map[expr->bitmap_index] = expr;
/* Walk over each basic block looking for potentially hoistable
- expressions, nothing gets hoisted from the entry block. */
+ expressions, nothing gets hoisted from the entry block.
+ ??? It maybe worthwhile to walk CFG in DFS order over the dominator tree.
+ One can imagine a case when a dominated block B is linked before
+ its dominator A, so if expressions were hoisted from blocks C and D,
+ which B (and A) dominates, then it may occur that we miss
+ an optimization of moving these expressions all the way to A.
+ Alternatively, we may handle this case by updating expressions'
+ occurences to include instructions emitted by code hoisting, i.e.,
+ an expression emitted at the end of B will then be hoisted to A. */
int found = 0;