Commit 106dec71 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR tree-optimization/29738 (Missed constant propagation into loops)

	PR tree-optimization/29738
	* tree-ssa-ccp.c: Remove UNKNOWN_VAL from comments.
	(ccp_lattice_t): Remove UNKNOWN_VAL.
	(dump_lattice_value, ccp_lattice_meet, ccp_visit_phi_node):
	Do not handle UNKNOWN_VAL.
	(get_default_value): Set initial value of virtual operands to
	VARYING.
	(get_value): Always use get_default_value on uninitialized
	operands.
	(set_value_varying, surely_varying_stmt_p): New functions.
	(set_lattice_value): Do not pass argument to get_value.
	Do not handle UNKNOWN_VAL.
	(likely_value): Follow the semantics described in the comment.
	(ccp_initialize): Use surely_varying_stmt_p.  Do not mark
	phi nodes DONT_SIMULATE_AGAIN.
	(ccp_fold): Do not pass argument to get_value.
	(fold_const_aggregate_ref, visit_assignment): Ditto.  Do not
	handle UNKNOWN_VAL.

	* gcc.dg/tree-ssa/ssa-ccp-14.c: New test.
	* gcc.dg/tree-ssa/ssa-ccp-15.c: New test.

From-SVN: r118602
parent 5e3c2d4c
2006-11-08 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/29738
* tree-ssa-ccp.c: Remove UNKNOWN_VAL from comments.
(ccp_lattice_t): Remove UNKNOWN_VAL.
(dump_lattice_value, ccp_lattice_meet, ccp_visit_phi_node):
Do not handle UNKNOWN_VAL.
(get_default_value): Set initial value of virtual operands to
VARYING.
(get_value): Always use get_default_value on uninitialized
operands.
(set_value_varying, surely_varying_stmt_p): New functions.
(set_lattice_value): Do not pass argument to get_value.
Do not handle UNKNOWN_VAL.
(likely_value): Follow the semantics described in the comment.
(ccp_initialize): Use surely_varying_stmt_p. Do not mark
phi nodes DONT_SIMULATE_AGAIN.
(ccp_fold): Do not pass argument to get_value.
(fold_const_aggregate_ref, visit_assignment): Ditto. Do not
handle UNKNOWN_VAL.
2006-11-08 Andrew Pinski <Andrew_Pinski@playstation.sony.com>
* tree-pretty-print.c (dump_generic_node) <INTEGER_CST>: Use
......
2006-11-08 Zdenek Dvorak <dvorakz@suse.cz>
* gcc.dg/tree-ssa/ssa-ccp-14.c: New test.
* gcc.dg/tree-ssa/ssa-ccp-15.c: New test.
2006-11-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-math-3.c: Add more sincos tests.
/* PR tree-optimization/29738. We used not to realize that "i" can never
become nonzero. */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
int i;
void foo (void);
void bar (void)
{
int j;
i = 0;
for (j = 0; j < 10000; j++)
if (i)
foo ();
}
/* Everything except for the "i = 0" assignment should get removed. */
/* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* Check that the initial values are honored when necessary. */
void link_error (void);
/* The call to link_error cannot be eliminated in this case. */
void test1 (int param1, int param2, int x)
{
if (param1)
x = 3;
if (param2)
if (x != 3)
link_error ();
}
/* The call to link_error cannot be eliminated in this case. */
int global;
void test2 (int param1, int param2)
{
if (param1)
global = 3;
if (param2)
if (global != 3)
link_error ();
}
/* In this case, we can eliminate the call, as unless "local" is set
to 3, its value is undefined. */
void test3 (int param1, int param2)
{
int local;
if (param1)
local = 3;
if (param2)
if (local != 3)
link_error ();
}
/* { dg-final { scan-tree-dump-times "link_error" 2 "optimized" } } */
/* { dg-final { cleanup-tree-dump "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