Commit 80c4ed35 by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/17671 (PHI-OPT is not smart enough)

2005-03-06  Andrew Pinski  <pinskia@physics.uc.edu>

	PR tree-opt/17671
	* 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.

2005-03-06  Andrew Pinski  <pinskia@physics.uc.edu>

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

From-SVN: r96067
parent 64022b5d
2005-03-06 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/17671
* 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.
2005-03-07 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000-protos.h: Rename output_e500_flip_eq_bit to
......
2005-03-06 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/17671
* gcc.dg/tree-ssa/phi-opt-[1-4].c: New tests.
2005-03-07 Mark Mitchell <mark@codesourcery.com>
* g++.dg/warn/Wnvdtor.C: New test.
......
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
int f(int a, int b, int c)
{
if (c == 0) goto temp;
if (a == 0)
return 0;
temp:
if (a == b)
return a;
return a;
}
/* There should be no ifs as the PHI arguments, we did not
optimize this before because PHI-OPT did not look at
PHIs which have more than two arguments. */
/* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
_Bool f1(_Bool a, _Bool b)
{
if (a)
{
if (b)
return 1;
else
return 0;
}
return 0;
}
/* There should be only one if, the outer one; the inner one
should have been changed to straight line code with the
value of b (except that we don't fold ! (b != 0) into b
which can be fixed in a different patch). */
/* { dg-final { scan-tree-dump-times "if" 1 "optimized"} } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
int f(int a, int b)
{
if (a == 0)
return 0;
if (a != b)
return a;
return a;
}
/* There should be no ifs as the PHI arguments, we did not
optimize this before because PHI-OPT did not look at
PHIs which have more than two arguments. */
/* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
_Bool t();
_Bool t1();
_Bool f1()
{
return t() && t1();
}
/* There should be only one if, the outer one; the inner one
should have been changed to straight line code with the
value of b (except that we don't fold ! (b != 0) into b
which means that we miss a sib calling opportunity). */
/* { dg-final { scan-tree-dump-times "if " 1 "optimized"} } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment