[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-07-02 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2009-07-02 12:16 ---
Subject: Bug 40585

Author: rguenth
Date: Thu Jul  2 12:15:27 2009
New Revision: 149172

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=149172
Log:
2009-07-02  Richard Guenther  rguent...@suse.de

PR middle-end/40585
* tree-cfg.c (tree_can_duplicate_bb_p): Disallow duplicating
basic blocks with RESX_EXPR.

Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/tree-cfg.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-07-02 Thread rguenth at gcc dot gnu dot org


--- Comment #8 from rguenth at gcc dot gnu dot org  2009-07-02 12:16 ---
Subject: Bug 40585

Author: rguenth
Date: Thu Jul  2 12:16:39 2009
New Revision: 149173

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=149173
Log:
2009-07-02  Richard Guenther  rguent...@suse.de

PR middle-end/40585
* tree-cfg.c (gimple_can_duplicate_bb_p): Disallow duplicating
basic blocks with GIMPLE_RESX.

Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/tree-cfg.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-07-01 Thread hubicka at ucw dot cz


--- Comment #4 from hubicka at ucw dot cz  2009-07-01 10:47 ---
Subject: Re:  [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting
EH tree

Hi,
the following patch should prevent tracer from copying resx.  It is
remarkably ugly I need to unconstify all the copy_bb_p predicates, so
perhaps I will look into fixing the RTL expanders to allow multiple RESX
blocks instead.

Index: cfghooks.c
===
--- cfghooks.c  (revision 149102)
+++ cfghooks.c  (working copy)
@@ -874,7 +874,7 @@ tidy_fallthru_edges (void)
 /* Returns true if we can duplicate basic block BB.  */

 bool
-can_duplicate_block_p (const_basic_block bb)
+can_duplicate_block_p (basic_block bb)
 {
   if (!cfg_hooks-can_duplicate_block_p)
 internal_error (%s does not support can_duplicate_block_p,
Index: cfghooks.h
===
--- cfghooks.h  (revision 149102)
+++ cfghooks.h  (working copy)
@@ -75,7 +75,7 @@ struct cfg_hooks
   bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor);

   /* Return true when block A can be duplicated.  */
-  bool (*can_duplicate_block_p) (const_basic_block a);
+  bool (*can_duplicate_block_p) (basic_block a);

   /* Duplicate block A.  */
   basic_block (*duplicate_block) (basic_block a);
@@ -160,7 +160,7 @@ extern void tidy_fallthru_edge (edge);
 extern void tidy_fallthru_edges (void);
 extern void predict_edge (edge e, enum br_predictor predictor, int
probability);
 extern bool predicted_by_p (const_basic_block bb, enum br_predictor
predictor);
-extern bool can_duplicate_block_p (const_basic_block);
+extern bool can_duplicate_block_p (basic_block);
 extern basic_block duplicate_block (basic_block, edge, basic_block);
 extern bool block_ends_with_call_p (basic_block bb);
 extern bool block_ends_with_condjump_p (const_basic_block bb);
Index: bb-reorder.c
===
--- bb-reorder.c(revision 149102)
+++ bb-reorder.c(working copy)
@@ -176,7 +176,7 @@ static basic_block copy_bb (basic_block,
 static fibheapkey_t bb_to_key (basic_block);
 static bool better_edge_p (const_basic_block, const_edge, int, int, int, int,
const_edge);
 static void connect_traces (int, struct trace *);
-static bool copy_bb_p (const_basic_block, int);
+static bool copy_bb_p (basic_block, int);
 static int get_uncond_jump_length (void);
 static bool push_to_next_round_p (const_basic_block, int, int, int,
gcov_type);
 static void find_rarely_executed_basic_blocks_and_crossing_edges (edge **,
@@ -1157,7 +1157,7 @@ connect_traces (int n_traces, struct tra
when code size is allowed to grow by duplication.  */

 static bool
-copy_bb_p (const_basic_block bb, int code_may_grow)
+copy_bb_p (basic_block bb, int code_may_grow)
 {
   int size = 0;
   int max_size = uncond_jump_length;
Index: tree-cfg.c
===
--- tree-cfg.c  (revision 149102)
+++ tree-cfg.c  (working copy)
@@ -5131,8 +5131,17 @@ gimple_move_block_after (basic_block bb,
 /* Return true if basic_block can be duplicated.  */

 static bool
-gimple_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
+gimple_can_duplicate_bb_p (basic_block bb)
 {
+  gimple_stmt_iterator gsi = gsi_last_bb (bb);
+
+  /* RTL expander has quite artificial limitation to at most one RESX
instruction
+ per region.  It can be fixed by turning 1-1 map to 1-many map, but since
the
+ code needs to be rewritten to gimple level lowering and there is little
reason
+ for duplicating RESX instructions in order to optimize code performance,
we
+ just disallow it for the moment.  */
+  if (!gsi_end_p (gsi)  gimple_code (gsi_stmt (gsi)) == GIMPLE_RESX)
+return false;
   return true;
 }

Index: cfgrtl.c
===
--- cfgrtl.c(revision 149102)
+++ cfgrtl.c(working copy)
@@ -3161,7 +3161,7 @@ struct cfg_hooks rtl_cfg_hooks = {
should only be used through the cfghooks interface, and we do not want to
move them here since it would require also moving quite a lot of related
code.  They are in cfglayout.c.  */
-extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
+extern bool cfg_layout_can_duplicate_bb_p (basic_block);
 extern basic_block cfg_layout_duplicate_bb (basic_block);

 struct cfg_hooks cfg_layout_rtl_cfg_hooks = {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-07-01 Thread rguenther at suse dot de


--- Comment #5 from rguenther at suse dot de  2009-07-01 10:54 ---
Subject: Re:  [4.3/4.4/4.5 Regression] tracer
 duplicates blocks w/o adjusting EH tree

On Wed, 1 Jul 2009, hubicka at ucw dot cz wrote:

 --- Comment #4 from hubicka at ucw dot cz  2009-07-01 10:47 ---
 Subject: Re:  [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting
 EH tree
 
 Hi,
 the following patch should prevent tracer from copying resx.  It is
 remarkably ugly I need to unconstify all the copy_bb_p predicates, so
 perhaps I will look into fixing the RTL expanders to allow multiple RESX
 blocks instead.

Less ugly would be to 'inline' gsi_last_bb by using

  gimple_seq seq = bb_seq (bb);
  gimple_seq_node last = gimple_seq_last (seq);
  if (last  gimple_code (last-stmt) == GIMPLE_RESX)
...

but yes, for trunk allowing mutliple RESX works for me as well.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-07-01 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2009-07-01 13:01 ---
I have a 4.3 backport along that line.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-06-29 Thread steven at gcc dot gnu dot org


--- Comment #1 from steven at gcc dot gnu dot org  2009-06-29 12:00 ---
Ack. Honza, yours I would guess.


-- 

steven at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-06-29 12:00:44
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-06-29 Thread steven at gcc dot gnu dot org


--- Comment #2 from steven at gcc dot gnu dot org  2009-06-29 12:02 ---
Richi, do you have a test case you can share?  I have seen this problem in code
I can't take public...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-06-29 Thread rguenther at suse dot de


--- Comment #3 from rguenther at suse dot de  2009-06-29 12:08 ---
Subject: Re:  [4.3/4.4/4.5 Regression] tracer
 duplicates blocks w/o adjusting EH tree

On Mon, 29 Jun 2009, steven at gcc dot gnu dot org wrote:

 --- Comment #2 from steven at gcc dot gnu dot org  2009-06-29 12:02 
 ---
 Richi, do you have a test case you can share?  I have seen this problem in 
 code
 I can't take public...

Likewise me, only reproducible with -fprofile-use and .gcda/.gcno
files from a customer...

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585



[Bug tree-optimization/40585] [4.3/4.4/4.5 Regression] tracer duplicates blocks w/o adjusting EH tree

2009-06-29 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40585