[PATCH] Do not set BB_SUPERBLOCK in loop-unroll.c:split_edge_and_insert
Steven Bosscher
stevenb.gcc@gmail.com
Sun Feb 25 17:37:00 GMT 2007
Hi,
This patch is a follow-up to a call-for-help I sent out last week:
http://gcc.gnu.org/ml/gcc/2007-02/msg00379.html
Further testing still doesn't show any breakage. Also, it turns out that
loop-unswitch.c also uses compare_and_jump_seq(), without considering the
possibility that compare_and_jump_seq may produce insn chains with more
than one jump. Apparently the BB_SUPERBLOCK trick in loop-unroll.c is
there to handle that possibility, but if loop-unswitch doesn't have to do
this, then I'm guessing that loop-unroll also doesn't need it.
So I'd like to just remove it, and replace it with a sanity check.
The worst thing that could happen with the attached patch is more test
suite failures iff something is broken by this change. I will revert the
patch and figure out a fix in case something does break.
Bootstrapped&tested on {i686,x86_64,ia64}-unknown-linux-gnu, plus the
testing mentioned in the replies to my cfg (including bootstrap on alpha
with loop unrolling enabled).
OK for the trunk?
Thanks,
Gr.
Steven
* loop-unroll.c (split_edge_and_insert): Do not allow callers
to insert insns with control flow insns in the middle of the
insns chain.
Index: loop-unroll.c
===================================================================
--- loop-unroll.c (revision 122261)
+++ loop-unroll.c (working copy)
@@ -868,7 +868,8 @@ decide_unroll_runtime_iterations (struct
/* Splits edge E and inserts the sequence of instructions INSNS on it, and
returns the newly created block. If INSNS is NULL_RTX, nothing is changed
- and NULL is returned instead. */
+ and NULL is returned instead.
+ INSNS may not contain control flow insns in the middle of the sequence. */
basic_block
split_edge_and_insert (edge e, rtx insns)
@@ -877,9 +878,27 @@ split_edge_and_insert (edge e, rtx insns
if (!insns)
return NULL;
+
+#ifdef ENABLE_CHECKING
+ {
+ rtx insn;
+
+ /* We should never insert control flow insns on an edge!
+ Only the last insn in INSNS can be a control flow insn.
+
+ This check is here because compare_and_jump_seq may
+ produce insns sequences with jumps. In practice, this
+ appears to be impossible to trigger. We want to be
+ very sure, though, that it really never happens, hence
+ the control flow insn trap here. */
+ for (insn = insns; NEXT_INSN (insn); insn = NEXT_INSN (insn))
+ if (control_flow_insn_p (insn))
+ gcc_unreachable ();
+ }
+#endif
+
bb = split_edge (e);
emit_insn_after (insns, BB_END (bb));
- bb->flags |= BB_SUPERBLOCK;
return bb;
}
More information about the Gcc-patches
mailing list