This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Set BB_PARTITION in cfg_layout_split_edge (PR rtl-optimization/33648)


While rtl_split_block, rtl_split_edge and indirectly also
cfg_layout_split_block (which calls rtl_split_block) take care of
initializing of BB_PARTITION of the newly added basic block,
cfg_layout_split_edge does not (so leave the new bb
as BB_UNPARTITIONED), which e.g. in case of swing modulo scheduling
pass which runs in cfglayout mode after bbpart and can call both
split_block and split_edge results in cfg verification failures, where
there are fallthrough edges between BB_UNPARTITIONED blocks and
hot (resp. cold) blocks.  With this patch cfg_layout_split_edge
will do the same thing for new_bb's BB_PARTITION as rtl_split_edge
does in normal rtl cfg mode.

Bootstrapped/regtested on x86_64-linux and also tested on the testcase
with ppc64-linux cross.

Ok for trunk?

2007-11-01  Jakub Jelinek  <>

	PR rtl-optimization/33648
	* cfgrtl.c (cfg_layout_split_edge): Initialize BB_PARTITION of
	the newly created basic block.

	* gcc.dg/pr33648.c: New test.

--- gcc/cfgrtl.c.jj	2007-10-26 13:45:45.000000000 +0200
+++ gcc/cfgrtl.c	2007-11-01 20:31:24.000000000 +0100
@@ -2696,6 +2696,10 @@ cfg_layout_split_edge (edge e)
 			? NEXT_INSN (BB_END (e->src)) : get_insns (),
 			NULL_RTX, e->src);
+  if (e->dest == EXIT_BLOCK_PTR)
+    BB_COPY_PARTITION (new_bb, e->src);
+  else
+    BB_COPY_PARTITION (new_bb, e->dest);
   make_edge (new_bb, e->dest, EDGE_FALLTHRU);
   redirect_edge_and_branch_force (e, new_bb);
--- gcc/testsuite/gcc.dg/pr33648.c.jj	2007-11-01 20:42:15.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr33648.c	2007-11-01 20:43:09.000000000 +0100
@@ -0,0 +1,13 @@
+/* PR rtl-optimization/33648 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fmodulo-sched -freorder-blocks-and-partition" } */
+unsigned res;
+foo (unsigned code, int len)
+  int i;
+  for (i = 0; i < len; i++)
+    res |= code & 1;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]