This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
One line performance tweak
- To: gcc-patches at gcc dot gnu dot org
- Subject: One line performance tweak
- From: "Zack Weinberg" <zackw at stanford dot edu>
- Date: Fri, 5 Jan 2001 12:23:39 -0800
- Cc: Peter Bienstman <Peter dot Bienstman at rug dot ac dot be>
This patch produces a 10% performance improvement on Peter Bienstman's
test case (see http://gcc.gnu.org/ml/gcc/2001-01/msg00218.html).
Before:
real 17m21.908s
user 17m15.310s
sys 0m6.200s
% cumulative self self total
time seconds seconds calls ms/call ms/call name
31.59 252.41 252.41 350236618 0.00 0.00 fixup_var_refs_1
27.52 472.28 219.87 79759 2.76 6.59 fixup_var_refs_insns
13.96 583.86 111.58 65184 1.71 1.71 push_to_sequence
4.55 620.18 36.32 85438845 0.00 0.00 reg_mentioned_p
After:
real 15m38.758s
user 15m32.000s
sys 0m6.190s
36.54 253.83 253.83 350236618 0.00 0.00 fixup_var_refs_1
32.60 480.32 226.49 79759 2.84 6.67 fixup_var_refs_insns
4.99 514.96 34.64 85438845 0.00 0.00 reg_mentioned_p
...
0.00 694.73 0.00 2601 0.00 0.00 push_to_sequence
All I did was change one call of push_to_sequence to push_to_full_sequence,
where we already knew the last insn in the sequence. There are other
calls of push_to_sequence in fixup_var_refs, but they don't cause a
bottleneck in this case. (I can argue that those sequences are likely
to be much shorter than the ones affected by this change, but I have
no evidence either way.)
I will bootstrap this along with a fix for cpplib's --help problem
(reported twice yesterday) - assuming it succeeds, OK to apply?
zw
===================================================================
Index: function.c
--- function.c 2001/01/04 23:28:00 1.240
+++ function.c 2001/01/05 20:23:04
@@ -1557,7 +1557,7 @@ fixup_var_refs (var, promoted_mode, unsi
/* Scan all pending sequences too. */
for (; stack; stack = stack->next)
{
- push_to_sequence (stack->first);
+ push_to_full_sequence (stack->first, stack->last);
fixup_var_refs_insns (var, promoted_mode, unsignedp,
stack->first, stack->next != 0, 0);
/* Update remembered end of sequence