diff mbox

gcc/ira-conflicts.c: avoid conflict obj compare with itself

Message ID 1416205860-30428-1-git-send-email-zhouzhouyi@gmail.com
State New
Headers show

Commit Message

Zhouyi Zhou Nov. 17, 2014, 6:31 a.m. UTC
From: Zhouyi Zhou <yizhouzhou@ict.ac.cn>

In function build_conflict_bit_table, id is set in objects_live before
traversing that sparseset, so the obj is unnessary compared with itself 
during the traversing. 
The comparing of obj with itself can be avoided by means of moving   
sparseset_set_bit (objects_live, id) after the traversing.

I have no write access to gcc repository and I can't provide a testcase
because the improvement has effective compile no output.
 
Bootstraped and regtested in x86_64 Linux 
Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
 gcc/ChangeLog       |    4 ++++
 gcc/ira-conflicts.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Jeff Law Nov. 17, 2014, 10:05 p.m. UTC | #1
On 11/16/14 23:31, Zhouyi Zhou wrote:
> From: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
>
> In function build_conflict_bit_table, id is set in objects_live before
> traversing that sparseset, so the obj is unnessary compared with itself
> during the traversing.
> The comparing of obj with itself can be avoided by means of moving
> sparseset_set_bit (objects_live, id) after the traversing.
>
> I have no write access to gcc repository and I can't provide a testcase
> because the improvement has effective compile no output.
>
> Bootstraped and regtested in x86_64 Linux
> Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
> ---
>   gcc/ChangeLog       |    4 ++++
>   gcc/ira-conflicts.c |    2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index d385e33..3f4b14e 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,7 @@
> +2014-11-17  Zhouyi Zhou  <yizhouzhou@ict.ac.cn>
> +
> +	* ira-conflicts.c (build_conflict_bit_table): avoid obj self comparing.
Thanks installed.

jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d385e33..3f4b14e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@ 
+2014-11-17  Zhouyi Zhou  <yizhouzhou@ict.ac.cn>
+
+	* ira-conflicts.c (build_conflict_bit_table): avoid obj self comparing.
+	
 2014-11-16  Jan Hubicka  <hubicka@ucw.cz>
 
 	* ipa-polymorphic-call.c
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 7aaf0cb..cccdb6b 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -177,7 +177,6 @@  build_conflict_bit_table (void)
 	  gcc_assert (id < ira_objects_num);
 
 	  aclass = ALLOCNO_CLASS (allocno);
-	  sparseset_set_bit (objects_live, id);
 	  EXECUTE_IF_SET_IN_SPARSESET (objects_live, j)
 	    {
 	      ira_object_t live_obj = ira_object_id_map[j];
@@ -191,6 +190,7 @@  build_conflict_bit_table (void)
 		  record_object_conflict (obj, live_obj);
 		}
 	    }
+	  sparseset_set_bit (objects_live, id);
 	}
 
       for (r = ira_finish_point_ranges[i]; r != NULL; r = r->finish_next)