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] Make remove_phi_arg_num useful.


Hi,

It's convenient to use remove_phi_arg_num() instead of remove_phi_arg()
when you've already identified the edge for the PHI arg.  But without
this patch, the out-of-ssa pass seems to get confused.

Bootstrapped and tested, OK?

Gr.
Steven


2003-08-06  Steven Bosscher  <steven@gcc.gnu.org>

	* tree-dfa.c (remove_phi_arg):  When the PHI no longer has
	arguments, don't remove it here, but do so...
	(remove_phi_arg_num): ...from here.

Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.141
diff -c -3 -p -r1.1.4.141 tree-dfa.c
*** tree-dfa.c	5 Aug 2003 21:07:41 -0000	1.1.4.141
--- tree-dfa.c	6 Aug 2003 19:01:18 -0000
*************** remove_phi_arg (tree phi, basic_block bl
*** 934,952 ****
        if (src_bb == block)
  	{
  	  remove_phi_arg_num (phi, i);
- 
- 	  /* Apparently we also use PHI_ARG_CAPACITY to determine if we've
- 	     already renamed PHI nodes.  So if we remove a PHI argument,
- 	     then we must reduce its capacity so that we still know
- 	     the PHI has been rewritten.  This means that any memory
- 	     statistics for this PHI may be incorrect.  */
- 	  PHI_ARG_CAPACITY (phi)--;
- 
- 	  /* If we removed the last PHI argument, then go ahead and
- 	     remove the PHI node.  */
- 	  if (PHI_NUM_ARGS (phi) == 0)
- 	    remove_phi_node (phi, NULL, bb_for_stmt (phi));
- 
  	  return;
  	}
      }
--- 934,939 ----
*************** remove_phi_arg_num (tree phi, int i)
*** 975,980 ****
--- 962,979 ----
    PHI_ARG_DEF (phi, num_elem - 1) = NULL_TREE;
    PHI_ARG_EDGE (phi, num_elem - 1) = NULL;
    PHI_NUM_ARGS (phi)--;
+ 
+   /* Apparently we also use PHI_ARG_CAPACITY to determine if we've
+      already renamed PHI nodes.  So if we remove a PHI argument,
+      then we must reduce its capacity so that we still know
+      the PHI has been rewritten.  This means that any memory
+      statistics for this PHI may be incorrect.  */
+   PHI_ARG_CAPACITY (phi)--;
+ 
+   /* If we removed the last PHI argument, then go ahead and
+      remove the PHI node.  */
+   if (PHI_NUM_ARGS (phi) == 0)
+     remove_phi_node (phi, NULL, bb_for_stmt (phi));
  }
  
  

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