diff mbox

[IRA] save a bitmap check

Message ID d774ee.38da1.14e24fd8cba.Coremail.yizhouzhou@ict.ac.cn
State New
Headers show

Commit Message

Zhouyi Zhou June 24, 2015, 9:54 a.m. UTC
In function assign_hard_reg, checking the bit of conflict_a in 
consideration_allocno_bitmap is unneccesary, because when retry_p is 
false, conflicting objects are always inside of the same loop_node
(this is ensured in function process_bb_node_lives which marks the
living objects to death near the end of that function).

   

Bootstrap and regtest scheduled on x86_64 GNU/Linux
Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
 gcc/ChangeLog   | 4 ++++
 gcc/ira-color.c | 6 ++----
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Jeff Law June 25, 2015, 4:01 a.m. UTC | #1
On 06/24/2015 03:54 AM, Zhouyi Zhou wrote:
>
> In function assign_hard_reg, checking the bit of conflict_a in
> consideration_allocno_bitmap is unneccesary, because when retry_p is
> false, conflicting objects are always inside of the same loop_node
> (this is ensured in function process_bb_node_lives which marks the
> living objects to death near the end of that function).
>
>
>
> Bootstrap and regtest scheduled on x86_64 GNU/Linux
> Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
> ---
>   gcc/ChangeLog   | 4 ++++
>   gcc/ira-color.c | 6 ++----
>   2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index d1f82b2..07605ae 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,7 @@
> +2015-06-24  Zhouyi Zhou  <yizhouzhou@ict.ac.cn>
> +
> +	* ira-color.c (assign_hard_reg): save a bitmap check
My concern here is the invariant you're exploiting to eliminate the 
redundant bitmap check is far from obvious and there's no good way I can 
see to ensure that invariant remains invariant.

Without some solid performance data indicating this is a notable 
compile-time improvement, I don't think it's a wise idea.

If it does turn out that this is a noteworthy compile-time improvement, 
then you would need a comment before this conditional explaining in 
detail why we don't need to check for conflict's allocno in 
consideration_allocno_bitmap.

Jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d1f82b2..07605ae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@ 
+2015-06-24  Zhouyi Zhou  <yizhouzhou@ict.ac.cn>
+
+	* ira-color.c (assign_hard_reg): save a bitmap check
+	
 2015-06-24  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
 	PR rtl-optimization/66306
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 6c53507..d7776d6 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1733,14 +1733,12 @@  assign_hard_reg (ira_allocno_t a, bool retry_p)
 	  /* Reload can give another class so we need to check all
 	     allocnos.  */
 	  if (!retry_p
-	      && (!bitmap_bit_p (consideration_allocno_bitmap,
-				 ALLOCNO_NUM (conflict_a))
-		  || ((!ALLOCNO_ASSIGNED_P (conflict_a)
+	      && ((!ALLOCNO_ASSIGNED_P (conflict_a)
 		       || ALLOCNO_HARD_REGNO (conflict_a) < 0)
 		      && !(hard_reg_set_intersect_p
 			   (profitable_hard_regs,
 			    ALLOCNO_COLOR_DATA
-			    (conflict_a)->profitable_hard_regs)))))
+			    (conflict_a)->profitable_hard_regs))))
 	    continue;
 	  conflict_aclass = ALLOCNO_CLASS (conflict_a);
 	  ira_assert (ira_reg_classes_intersect_p