This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] tree-flow-inline.h: Speed up phi_nodes.


Hi,

Attached is a patch to speed up phi_nodes.

phi_nodes has a check for ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR like so

  if (bb->index < 0)
    return NULL;

but it is unnecessary because tree-cfg.c:build_tree_cfg has the
following.

  create_block_annotation (ENTRY_BLOCK_PTR);
  create_block_annotation (EXIT_BLOCK_PTR);

Of couse, we don't put PHI nodes in either of these blocks, so
phi_nodes would correctly return NULL anyway without the check.

Here is the timing for 10 runs of "cc1 -O2 -o /dev/null fold-const.i".

      original          patched
real:  184.416   183.755 (0.358% down)
user:  181.688   181.029 (0.362% down)

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-10-07  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-flow-inline.h (phi_nodes): Remove an unnecessary check
	for ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR.

Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.23
diff -u -r2.23 tree-flow-inline.h
--- tree-flow-inline.h	11 Sep 2004 20:42:06 -0000	2.23
+++ tree-flow-inline.h	7 Oct 2004 13:47:39 -0000
@@ -363,8 +363,6 @@
 static inline tree
 phi_nodes (basic_block bb)
 {
-  if (bb->index < 0)
-    return NULL;
   return bb_ann (bb)->phi_nodes;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]