Commit 63e037f4 by Teresa Johnson Committed by Teresa Johnson

Redesign jump threading profile updates to avoid introducing insanities.

gcc:

2014-09-30  Teresa Johnson  <tejohnson@google.com>

	* tree-ssa-threadupdate.c (struct ssa_local_info_t): New
	duplicate_blocks bitmap.
	(remove_ctrl_stmt_and_useless_edges): Ditto.
	(create_block_for_threading): Ditto.
	(compute_path_counts): New function.
	(update_profile): Ditto.
	(recompute_probabilities): Ditto.
	(update_joiner_offpath_counts): Ditto.
	(freqs_to_counts_path): Ditto.
	(clear_counts_path): Ditto.
	(ssa_fix_duplicate_block_edges): Update profile info.
	(ssa_create_duplicates): Pass new parameter.
	(ssa_redirect_edges): Remove old profile update.
	(thread_block_1): New duplicate_blocks bitmap,
	remove old profile update.
	(thread_single_edge): Pass new parameter.

gcc/testsuite:

2014-09-30  Teresa Johnson  <tejohnson@google.com>

	* testsuite/gcc.dg/tree-prof/20050826-2.c: New test.
	* testsuite/gcc.dg/tree-prof/cmpsf-1.c: Ditto.

From-SVN: r215739
parent dd5d5481
2014-09-30 Teresa Johnson <tejohnson@google.com>
* tree-ssa-threadupdate.c (struct ssa_local_info_t): New
duplicate_blocks bitmap.
(remove_ctrl_stmt_and_useless_edges): Ditto.
(create_block_for_threading): Ditto.
(compute_path_counts): New function.
(update_profile): Ditto.
(recompute_probabilities): Ditto.
(update_joiner_offpath_counts): Ditto.
(freqs_to_counts_path): Ditto.
(clear_counts_path): Ditto.
(ssa_fix_duplicate_block_edges): Update profile info.
(ssa_create_duplicates): Pass new parameter.
(ssa_redirect_edges): Remove old profile update.
(thread_block_1): New duplicate_blocks bitmap,
remove old profile update.
(thread_single_edge): Pass new parameter.
2014-09-30 Ilya Tocar <ilya.tocar@intel.com>
PR middle-end/62120
2014-09-30 Teresa Johnson <tejohnson@google.com>
* gcc.dg/tree-prof/20050826-2.c: New test.
* gcc.dg/tree-prof/cmpsf-1.c: Ditto.
2014-09-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/16564
......
/* Testcase derived from gcc.c-torture/execute 20050826-2.c
which showed jump threading profile insanities. */
/* { dg-options "-Ofast -fdump-tree-dom1-all" } */
struct rtattr
{
unsigned short rta_len;
unsigned short rta_type;
};
__attribute__ ((noinline))
int inet_check_attr (void *r, struct rtattr **rta)
{
int i;
for (i = 1; i <= 14; i++)
{
struct rtattr *attr = rta[i - 1];
if (attr)
{
if (attr->rta_len - sizeof (struct rtattr) < 4)
return -22;
if (i != 9 && i != 8)
rta[i - 1] = attr + 1;
}
}
return 0;
}
extern void abort (void);
int
test (void)
{
struct rtattr rt[2];
struct rtattr *rta[14];
int i;
rt[0].rta_len = sizeof (struct rtattr) + 8;
rt[0].rta_type = 0;
rt[1] = rt[0];
for (i = 0; i < 14; i++)
rta[i] = &rt[0];
if (inet_check_attr (0, rta) != 0)
abort ();
for (i = 0; i < 14; i++)
if (rta[i] != &rt[i != 7 && i != 8])
abort ();
for (i = 0; i < 14; i++)
rta[i] = &rt[0];
rta[1] = 0;
rt[1].rta_len -= 8;
rta[5] = &rt[1];
if (inet_check_attr (0, rta) != -22)
abort ();
for (i = 0; i < 14; i++)
if (i == 1 && rta[i] != 0)
abort ();
else if (i != 1 && i <= 5 && rta[i] != &rt[1])
abort ();
else if (i > 5 && rta[i] != &rt[0])
abort ();
return 0;
}
int
main (void)
{
int i;
for (i=0; i<100; i++)
test ();
return 0;
}
/* { dg-final-use { scan-tree-dump-not "Invalid sum" "dom1"} } */
/* Testcase derived from gcc.c-torture/execute cmpsf-1.c
which showed jump threading profile insanities. */
/* { dg-options "-Ofast -fdump-tree-dom1-all" } */
#include <limits.h>
void abort();
extern void exit (int);
#define F 140
#define T 13
feq (float x, float y)
{
if (x == y)
return T;
else
return F;
}
fne (float x, float y)
{
if (x != y)
return T;
else
return F;
}
flt (float x, float y)
{
if (x < y)
return T;
else
return F;
}
fge (float x, float y)
{
if (x >= y)
return T;
else
return F;
}
fgt (float x, float y)
{
if (x > y)
return T;
else
return F;
}
fle (float x, float y)
{
if (x <= y)
return T;
else
return F;
}
float args[] =
{
0.0F,
1.0F,
-1.0F,
__FLT_MAX__,
__FLT_MIN__,
0.0000000000001F,
123456789.0F,
-987654321.0F
};
int correct_results[] =
{
T, F, F, T, F, T,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
T, F, F, T, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, T, F, F, T,
T, F, F, T, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
T, F, F, T, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
T, F, F, T, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
T, F, F, T, F, T,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, F, T, T, F,
F, T, F, T, T, F,
T, F, F, T, F, T,
F, T, F, T, T, F,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
F, T, T, F, F, T,
T, F, F, T, F, T,
};
void
test (void)
{
int i, j, *res = correct_results;
for (i = 0; i < 8; i++)
{
float arg0 = args[i];
for (j = 0; j < 8; j++)
{
float arg1 = args[j];
if (feq (arg0, arg1) != *res++)
abort ();
if (fne (arg0, arg1) != *res++)
abort ();
if (flt (arg0, arg1) != *res++)
abort ();
if (fge (arg0, arg1) != *res++)
abort ();
if (fgt (arg0, arg1) != *res++)
abort ();
if (fle (arg0, arg1) != *res++)
abort ();
}
}
}
int
main (void)
{
int i;
for (i=0; i<100; i++)
test ();
exit (0);
}
/* { dg-final-use { scan-tree-dump-not "Invalid sum" "dom1"} } */
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