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]

[tree-ssa] Speed up tree-ssa-ccp


One of Gerald's testcases exposed that CCP can do a lot of unnecessary
in some cases.

Specifically, if we have already determined that a PHI node's value is
VARYING, then there's no need to examine all its arguments again to
determine that it's still VARYING.  Duh.

This nearly cuts the CCP time in half for the one testcase I looked at.

	* tree-ssa-ccp.c (visit_phi_node): If the PHI is already known
	to be varying, don't recompute its value.

Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.72
diff -c -3 -p -r1.1.2.72 tree-ssa-ccp.c
*** tree-ssa-ccp.c	13 Jun 2003 19:00:18 -0000	1.1.2.72
--- tree-ssa-ccp.c	15 Jun 2003 07:13:54 -0000
*************** visit_phi_node (tree phi)
*** 360,367 ****
    phi_val.lattice_val = UNDEFINED;
    phi_val.const_val = NULL_TREE;
  
!   /* If the variable is volatile, consider it VARYING.  */
!   if (TREE_THIS_VOLATILE (SSA_NAME_VAR (PHI_RESULT (phi))))
      phi_val.lattice_val = VARYING;
    else
      for (i = 0; i < PHI_NUM_ARGS (phi); i++)
--- 360,369 ----
    phi_val.lattice_val = UNDEFINED;
    phi_val.const_val = NULL_TREE;
  
!   /* If the variable is volatile or we have already determined it
!      to be varying, then consider it VARYING.  */
!   if (TREE_THIS_VOLATILE (SSA_NAME_VAR (PHI_RESULT (phi)))
!       || get_value (PHI_RESULT (phi))->lattice_val == VARYING)
      phi_val.lattice_val = VARYING;
    else
      for (i = 0; i < PHI_NUM_ARGS (phi); i++)




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