Fix profile update in tree-ssa-isolate-paths.c (PR tree-optimization/82059).

2017-09-01  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/82059
	* gimple-ssa-isolate-paths.c (isolate_path): Add profile and
	frequency only when an edge is redirected.
2017-09-01  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/82059
	* gcc.dg/tree-ssa/pr82059.c: New test.

From-SVN: r251591
This commit is contained in:
Martin Liska 2017-09-01 15:02:37 +02:00 committed by Martin Liska
parent a2de90a45a
commit 002618d874
4 changed files with 39 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2017-09-01 Martin Liska <mliska@suse.cz>
PR tree-optimization/82059
* gimple-ssa-isolate-paths.c (isolate_path): Add profile and
frequency only when an edge is redirected.
2017-09-01 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc-c.c (__ARC_LPC_WIDTH__): Add builtin define.

View File

@ -160,14 +160,17 @@ isolate_path (basic_block bb, basic_block duplicate,
for (ei = ei_start (duplicate->succs); (e2 = ei_safe_edge (ei)); )
remove_edge (e2);
}
bb->frequency += EDGE_FREQUENCY (e);
bb->count += e->count;
/* Complete the isolation step by redirecting E to reach DUPLICATE. */
e2 = redirect_edge_and_branch (e, duplicate);
if (e2)
flush_pending_stmts (e2);
{
flush_pending_stmts (e2);
/* Update profile only when redirection is really processed. */
bb->frequency += EDGE_FREQUENCY (e);
bb->count += e->count;
}
/* There may be more than one statement in DUPLICATE which exhibits
undefined behavior. Ultimately we want the first such statement in

View File

@ -1,3 +1,8 @@
2017-09-01 Martin Liska <mliska@suse.cz>
PR tree-optimization/82059
* gcc.dg/tree-ssa/pr82059.c: New test.
2017-09-01 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/loop-1.c: Deleted.

View File

@ -0,0 +1,22 @@
/* PR tree-optimization/82059 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
struct a
{
char b;
struct a *c;
} d (), f;
void *e;
long g;
void
h ()
{
struct a *i = 0;
if (g)
i = e;
if (!i)
d ();
i->c = &f;
i->b = *(char *) h;
}