Commit b82ef848 by Richard Biener Committed by Richard Biener

re PR tree-optimization/61438 (ICE on valid code at -O3 on x86_64-linux-gnu in…

re PR tree-optimization/61438 (ICE on valid code at -O3 on x86_64-linux-gnu in in loop_preheader_edge, at cfgloop.c:1668)

2014-06-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/61438
	* tree-ssa-pre.c (eliminate_dom_walker): Add do_pre member.
	(eliminate_dom_walker::before_dom_children): Only try to inhibit
	insertion of IVs if running PRE.
	(eliminate): Adjust.
	(pass_pre::execute): Likewise.
	(pass_fre::execute): Likewise.

	* gcc.dg/torture/pr61438.c: New testcase.

From-SVN: r211413
parent cdf0ab72
2014-06-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/61438
* tree-ssa-pre.c (eliminate_dom_walker): Add do_pre member.
(eliminate_dom_walker::before_dom_children): Only try to inhibit
insertion of IVs if running PRE.
(eliminate): Adjust.
(pass_pre::execute): Likewise.
(pass_fre::execute): Likewise.
2014-06-10 Richard Biener <rguenther@suse.de>
PR middle-end/61456
* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p):
Do not use the main variant for the type comparison.
......
2014-06-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/61438
* gcc.dg/torture/pr61438.c: New testcase.
2014-06-10 Richard Biener <rguenther@suse.de>
PR middle-end/61456
* g++.dg/opt/pr61456.C: New testcase.
......
/* { dg-do run } */
extern void abort (void);
int a, c, **d, e, g;
static int b = 1;
struct
{
int f0;
} f;
void
foo ()
{
int h, *i = &a;
for (; e;)
{
for (c = 0; c < 1; c++)
for (; b;)
;
for (;;)
{
if (a)
{
for (; f.f0; f.f0++)
;
if (g)
break;
}
for (h = 0; h < 2; h++)
{
i = *d;
if (!i)
abort ();
}
}
}
if (!i)
abort ();
}
int
main ()
{
foo ();
return 0;
}
......@@ -3992,10 +3992,13 @@ eliminate_insert (gimple_stmt_iterator *gsi, tree val)
class eliminate_dom_walker : public dom_walker
{
public:
eliminate_dom_walker (cdi_direction direction) : dom_walker (direction) {}
eliminate_dom_walker (cdi_direction direction, bool do_pre_)
: dom_walker (direction), do_pre (do_pre_) {}
virtual void before_dom_children (basic_block);
virtual void after_dom_children (basic_block);
bool do_pre;
};
/* Perform elimination for the basic-block B during the domwalk. */
......@@ -4192,7 +4195,8 @@ eliminate_dom_walker::before_dom_children (basic_block b)
variable. In other cases the vectorizer won't do anything
anyway (either it's loop invariant or a complicated
expression). */
if (flag_tree_loop_vectorize
if (do_pre
&& flag_tree_loop_vectorize
&& gimple_assign_single_p (stmt)
&& TREE_CODE (sprime) == SSA_NAME
&& loop_outer (b->loop_father))
......@@ -4434,7 +4438,7 @@ eliminate_dom_walker::after_dom_children (basic_block)
/* Eliminate fully redundant computations. */
static unsigned int
eliminate (void)
eliminate (bool do_pre)
{
gimple_stmt_iterator gsi;
gimple stmt;
......@@ -4448,7 +4452,8 @@ eliminate (void)
el_avail.create (0);
el_avail_stack.create (0);
eliminate_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
eliminate_dom_walker (CDI_DOMINATORS,
do_pre).walk (cfun->cfg->x_entry_block_ptr);
el_avail.release ();
el_avail_stack.release ();
......@@ -4779,7 +4784,7 @@ pass_pre::execute (function *fun)
gsi_commit_edge_inserts ();
/* Remove all the redundant expressions. */
todo |= eliminate ();
todo |= eliminate (true);
statistics_counter_event (fun, "Insertions", pre_stats.insertions);
statistics_counter_event (fun, "PA inserted", pre_stats.pa_insert);
......@@ -4864,7 +4869,7 @@ pass_fre::execute (function *fun)
memset (&pre_stats, 0, sizeof (pre_stats));
/* Remove all the redundant expressions. */
todo |= eliminate ();
todo |= eliminate (false);
todo |= fini_eliminate ();
......
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