Commit 09302442 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/49419 (gcc -O2 miscompiles gp2c)

	PR tree-optimization/49419
	* tree-vrp.c (execute_vrp): Call init_range_assertions
	before estimate_numbers_of_iterations, call
	free_number_of_iterations_estimates before calling
	remove_range_assertions.

	* gcc.c-torture/execute/pr49419.c: New test.

From-SVN: r175092
parent 81c41166
2011-06-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/49419
* tree-vrp.c (execute_vrp): Call init_range_assertions
before estimate_numbers_of_iterations, call
free_number_of_iterations_estimates before calling
remove_range_assertions.
2011-06-16 Revital Eres <revital.eres@linaro.org> 2011-06-16 Revital Eres <revital.eres@linaro.org>
* modulo-sched.c (struct ps_insn): Remove row_rest_count field. * modulo-sched.c (struct ps_insn): Remove row_rest_count field.
......
2011-06-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/49419
* gcc.c-torture/execute/pr49419.c: New test.
2011-06-16 Revital Eres <revital.eres@linaro.org> 2011-06-16 Revital Eres <revital.eres@linaro.org>
* gcc.dg/sms-9.c: New file. * gcc.dg/sms-9.c: New file.
......
/* PR tree-optimization/49419 */
extern void abort (void);
struct S { int w, x, y; } *t;
int
foo (int n, int f, int *s, int m)
{
int x, i, a;
if (n == -1)
return 0;
for (x = n, i = 0; t[x].w == f && i < m; i++)
x = t[x].x;
if (i == m)
abort ();
a = i + 1;
for (x = n; i > 0; i--)
{
s[i] = t[x].y;
x = t[x].x;
}
s[0] = x;
return a;
}
int
main (void)
{
int s[3], i;
struct S buf[3] = { { 1, 1, 2 }, { 0, 0, 0 }, { 0, 0, 0 } };
t = buf;
if (foo (0, 1, s, 3) != 2)
abort ();
if (s[0] != 1 || s[1] != 2)
abort ();
return 0;
}
...@@ -7728,14 +7728,14 @@ execute_vrp (void) ...@@ -7728,14 +7728,14 @@ execute_vrp (void)
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa); rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
scev_initialize (); scev_initialize ();
insert_range_assertions ();
/* Estimate number of iterations - but do not use undefined behavior /* Estimate number of iterations - but do not use undefined behavior
for this. We can't do this lazily as other functions may compute for this. We can't do this lazily as other functions may compute
this using undefined behavior. */ this using undefined behavior. */
free_numbers_of_iterations_estimates (); free_numbers_of_iterations_estimates ();
estimate_numbers_of_iterations (false); estimate_numbers_of_iterations (false);
insert_range_assertions ();
to_remove_edges = VEC_alloc (edge, heap, 10); to_remove_edges = VEC_alloc (edge, heap, 10);
to_update_switch_stmts = VEC_alloc (switch_update, heap, 5); to_update_switch_stmts = VEC_alloc (switch_update, heap, 5);
threadedge_initialize_values (); threadedge_initialize_values ();
...@@ -7744,6 +7744,8 @@ execute_vrp (void) ...@@ -7744,6 +7744,8 @@ execute_vrp (void)
ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node); ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node);
vrp_finalize (); vrp_finalize ();
free_numbers_of_iterations_estimates ();
/* ASSERT_EXPRs must be removed before finalizing jump threads /* ASSERT_EXPRs must be removed before finalizing jump threads
as finalizing jump threads calls the CFG cleanup code which as finalizing jump threads calls the CFG cleanup code which
does not properly handle ASSERT_EXPRs. */ does not properly handle ASSERT_EXPRs. */
......
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