[tcb] Merge PHI nodes -- 7.4% reduction of PHI nodes.

Daniel Berlin dberlin@dberlin.org
Sun Sep 19 21:00:00 GMT 2004


On Sep 19, 2004, at 2:53 PM, Kazu Hirata wrote:

> Hi,
>
> Attached is a patch to merge PHI nodes.  Consider:
>
>   # ptr_5 = PHI <0B(8), ptr_4(7)>;
> <L16>:;
>
>   # ptr_1 = PHI <D.9200_13(1), ptr_5(9), D.9200_13(0)>;
> <L18>:;
>   if (ptr_1 == 0B) goto <L21>; else goto <L20>;
>
> Note that we can merge the two PHI nodes.  That is, we can redirect
> incoming edges to <L16> to <L18> like so:
>
>   # ptr_1 = PHI <D.9200_13(1), ptr_4(7), D.9200_13(0), 0B(8)>;
> <L18>:;
>   if (ptr_1 == 0B) goto <L21>; else goto <L20>;
>
> Note that we expose one jump threading opportunity, namely the
> incoming edge from basic block 8, aside from direct benefits like
> fewer basic blocks, fewer SSA_NAMEs, and such.
>
> This patch reduces the number of PHI nodes by 7.4% on GCC's source
> code.
>
>


> Kazu Hirata
>
> 2004-09-18  Kazu Hirata  <kazu@cs.umass.edu>
>
> 	PR tree-optimization/15349
> 	* Makefile.in (OBJS-common): Add tree-ssa-mergephi.o.
> 	* timevar.def (TV_TREE_MERGEPHI): New.
> 	* tree-cfg.c (tree_split_edge): Make it extern.
> 	* tree-flow.h: Add a prototype for tree_split_edge.
> 	* tree-optimize.c (init_tree_optimization_passes): Add
> 	pass_mergephi.
> 	* tree-pass.h: Add a prototype for pass_mergephi.
> 	* tree-ssa-mergephi.h: New.
>
Why did you externify tree_split_edge when split_edge will call it for 
you?



More information about the Gcc-patches mailing list