Patchwork 0007-Add-open-ended-comments.patch

login
register
mail settings
Submitter Maxim Kuvyrkov
Date June 23, 2010, 8:22 p.m.
Message ID <4C226CF0.1060408@codesourcery.com>
Download mbox | patch
Permalink /patch/56711/
State New
Headers show

Comments

Maxim Kuvyrkov - June 23, 2010, 8:22 p.m.
On 6/16/10 9:18 PM, Jeff Law wrote:
>> This patch adds several open-ended comments in gcse.c.  I'll be happy
>> if anyone can answer some of them, in which case I'll check in the
>> answers, rather than questions :).
>>
>> Thank you,
>>
> @@ -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. */
> See pre_edge_insert and search for EDGE_ABNORMAL.
>
> That code went through several iterations and may no longer be
> necessary. So we really should extend the existing comment before the
> call to insert_insn_end_basic_block from pre_edge_insert.

I tried making pre_edge_insert to call insert_insn_end_basic_block with 
(pre == 1), and that failed with segmentation fault due to antloc being 
NULL.

Anyway, the attached patch removes unused checks.

OK to check in?

Patch

diff --git a/gcc/gcse.c b/gcc/gcse.c
index ff8dbc2..b95be91 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -491,7 +491,7 @@  static void free_pre_mem (void);
 static void compute_pre_data (void);
 static int pre_expr_reaches_here_p (basic_block, struct expr *,
 				    basic_block);
-static void insert_insn_end_basic_block (struct expr *, basic_block, int);
+static void insert_insn_end_basic_block (struct expr *, basic_block);
 static void pre_insert_copy_insn (struct expr *, rtx);
 static void pre_insert_copies (void);
 static int pre_delete (void);
@@ -3453,14 +3453,10 @@  process_insert_insn (struct expr *expr)
 
 /* Add EXPR to the end of basic block BB.
 
-   This is used by both the PRE and code hoisting.
-
-   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.  */
+   This is used by both the PRE and code hoisting.  */
 
 static void
-insert_insn_end_basic_block (struct expr *expr, basic_block bb, int pre)
+insert_insn_end_basic_block (struct expr *expr, basic_block bb)
 {
   rtx insn = BB_END (bb);
   rtx new_insn;
@@ -3487,12 +3483,6 @@  insert_insn_end_basic_block (struct expr *expr, basic_block bb, int pre)
 #ifdef HAVE_cc0
       rtx note;
 #endif
-      /* It should always be the case that we can put these instructions
-	 anywhere in the basic block with performing PRE optimizations.
-	 Check this.  */
-      gcc_assert (!NONJUMP_INSN_P (insn) || !pre
-		  || TEST_BIT (antloc[bb->index], expr->bitmap_index)
-		  || TEST_BIT (transp[bb->index], expr->bitmap_index));
 
       /* If this is a jump table, then we can't insert stuff here.  Since
 	 we know the previous real insn must be the tablejump, we insert
@@ -3529,15 +3519,7 @@  insert_insn_end_basic_block (struct expr *expr, basic_block bb, int pre)
       /* Keeping in mind targets with small register classes and parameters
          in registers, we search backward and place the instructions before
 	 the first parameter is loaded.  Do this for everyone for consistency
-	 and a presumption that we'll get better code elsewhere as well.
-
-	 It should always be the case that we can put these instructions
-	 anywhere in the basic block with performing PRE optimizations.
-	 Check this.  */
-
-      gcc_assert (!pre
-		  || TEST_BIT (antloc[bb->index], expr->bitmap_index)
-		  || TEST_BIT (transp[bb->index], expr->bitmap_index));
+	 and a presumption that we'll get better code elsewhere as well.  */
 
       /* Since different machines initialize their parameter registers
 	 in different orders, assume nothing.  Collect the set of all
@@ -3634,7 +3616,7 @@  pre_edge_insert (struct edge_list *edge_list, struct expr **index_map)
 			   now.  */
 
 			if (eg->flags & EDGE_ABNORMAL)
-			  insert_insn_end_basic_block (index_map[j], bb, 0);
+			  insert_insn_end_basic_block (index_map[j], bb);
 			else
 			  {
 			    insn = process_insert_insn (index_map[j]);
@@ -4685,7 +4667,7 @@  hoist_code (void)
 
 		      if (!insn_inserted_p)
 			{
-			  insert_insn_end_basic_block (index_map[i], bb, 0);
+			  insert_insn_end_basic_block (index_map[i], bb);
 			  insn_inserted_p = 1;
 			}
 		    }