[tcb] [RFC] partial rewrite of PHI-OPT

Andrew Pinski pinskia@physics.uc.edu
Thu Oct 7 19:14:00 GMT 2004


On Oct 6, 2004, at 9:03 AM, Diego Novillo wrote:

> On Sun, 2004-10-03 at 20:59, Andrew Pinski wrote:
>
>> OK? This has been bootstrapped and tested on powerpc-darwin with no
>> regressions.
>>
> OK, but please add 1 or 2 tests.

I had messed up when converting to use the new edge vectors which made
we reject every Basic Block.

The only difference between this patch and the previous one is:
!       /* Also make that bb1 only have one pred and it is bb. */
!       if (EDGE_COUNT (bb1->preds) > 1
!           || e1->src != bb)
! 	continue;

Gets changed to (which is more to what the comment says as e1 no longer
at this point, point to the edge between bb and bb1):
!       /* Also make that bb1 only have one pred and it is bb. */
!       if (EDGE_COUNT (bb1->preds) > 1
!           || EDGE_PRED (bb1, 0)->src != bb)
! 	continue;

Also I have included 4 testcases for the testsuite.  One is taken from
real code, phi-opt-4.c comes from the C++ front-end; the others are made
up and don't represent any code that I know of.

OK once bootstrapped and tested?

Thanks,
Andrew Pinski

ChangeLog:
	* tree-ssa-phiopt.c (tree_ssa_phiopt): Rewrite so we base the
	bbs on the COND_EXPR instead of the PHI_NODEs.
	(candidate_bb_for_phi_optimization): Remove.
	(replace_phi_with_stmt): Rename to ...
	(replace_phi_edge_with_variable): this and change so that we
	replace the phi argument instead of removing the PHI.
	(conditional_replacement): Change so we deal with PHI with more
	than two arguments.
	(value_replacement): Likewise.
	(abs_replacement): Likewise.

testsuite/ChangeLog:
	* gcc.dg/tree-ssa/phi-opt-[1-4].c: New tests.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: temp.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041007/d109e231/attachment.txt>


More information about the Gcc-patches mailing list