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] O(1) PHI argument look-up - Part 21/n


Hi,

Attached is part 21 of my O(1) PHI argument look-up patch.

phi_arg_from_edge never returns -1.  The return value of -1 used to
mean that a PHI argument is missing for a given edge.  These days, a
"missing PHI argument" is represented by putting NULL_TREE in the
corresponding PHI argument slot, so we have to use

  gcc_assert (PHI_ARG_DEF (phi, e) != NULL_TREE);

The patch updates an instance of gcc_assert.  Also, the patch moves
the use phi_arg_from_edge out of the loop as its result is loop
invariant.

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

Kazu Hirata

2004-12-02  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (phi_alternatives_equal): Check that PHI_ARG_DEF
	is not null.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.129
diff -c -d -p -r2.129 tree-cfg.c
*** tree-cfg.c	30 Nov 2004 03:52:37 -0000	2.129
--- tree-cfg.c	1 Dec 2004 22:41:09 -0000
*************** thread_jumps_from_bb (basic_block bb)
*** 3943,3949 ****
        edge last, old;
        basic_block dest, tmp, curr, old_dest;
        tree phi;
-       int arg;
  
        /* If the edge is abnormal or its destination is not
  	 forwardable, then there's nothing to do.  */
--- 3943,3948 ----
*************** thread_jumps_from_bb (basic_block bb)
*** 4030,4040 ****
  	     have the same value as the argument associated with LAST.
  	     Otherwise we would have changed our target block
  	     above.  */
  	  for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
  	    {
! 	      arg = phi_arg_from_edge (phi, last);
! 	      gcc_assert (arg >= 0);
! 	      add_phi_arg (phi, PHI_ARG_DEF (phi, arg), e);
  	    }
  	}
  
--- 4029,4041 ----
  	     have the same value as the argument associated with LAST.
  	     Otherwise we would have changed our target block
  	     above.  */
+ 	  int arg = last->dest_idx;
+ 
  	  for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
  	    {
! 	      tree def = PHI_ARG_DEF (phi, arg);
! 	      gcc_assert (def != NULL_TREE);
! 	      add_phi_arg (phi, def, e);
  	    }
  	}
  


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