On 06/24/2015 05: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).
Thanks for reporting this. I believe you are right the bitmap check
is not necessary. When I wrote the code I keep in my mind other
possibilities which were not implemented and I don't see the code will
be necessary for foreseeable future.
Of course the effect on compilation time is tiny (it is about 0.05%
reported by valgrind lackey on compilation of combine.c with -O2).
Still it is a bit uncomfortable for me that my code wastes unnecessary
computer cycles.
So I modified a bit your code taking Jeff's proposals into account and
committed it into trunk.
The patch was bootstrapped on x86-64.
Committed as rev. 224944.
Your email reminded me that I need to commit another your patch
which I promised to commit when GCC is on stage1. I am going to do it today.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 224943)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2015-06-25 Zhouyi Zhou <yizhouz...@ict.ac.cn>
+ Vladimir Makarov <vmaka...@redhat.com>
+
+ * ira-color.c (assign_hard_reg): Remove unecessary bitmap check.
+ Add assert.
+
2015-06-25 Richard Biener <rguent...@suse.de>
* fold-const.c (fold_binary_loc): Move simplification of
Index: ira-color.c
===================================================================
--- ira-color.c (revision 224943)
+++ ira-color.c (working copy)
@@ -1733,15 +1733,22 @@ assign_hard_reg (ira_allocno_t a, bool r
/* 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_HARD_REGNO (conflict_a) < 0)
- && !(hard_reg_set_intersect_p
- (profitable_hard_regs,
- ALLOCNO_COLOR_DATA
- (conflict_a)->profitable_hard_regs)))))
- continue;
+ && ((!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))))
+ {
+ /* All conflict allocnos are in consideration bitmap
+ when retry_p is false. It might change in future and
+ if it happens the assert will be broken. It means
+ the code should be modified for the new
+ assumptions. */
+ ira_assert (bitmap_bit_p (consideration_allocno_bitmap,
+ ALLOCNO_NUM (conflict_a)));
+ continue;
+ }
conflict_aclass = ALLOCNO_CLASS (conflict_a);
ira_assert (ira_reg_classes_intersect_p
[aclass][conflict_aclass]);