Commit b57cca0b by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/51933 (wrong code due to -free)

	PR rtl-optimization/51933
	* ree.c (transform_ifelse): Return true right away if dstreg is
	already wider or equal to cand->mode.
	(enum ext_modified_kind, struct ext_modified, ext_state): New types.
	(make_defs_and_copies_lists): Remove defs_list and copies_list
	arguments, add state argument, just truncate state->work_list
	instead of always allocating and freeing the vector.  Assert that
	get_defs succeeds instead of returning 2.  Changed return type to
	bool.
	(merge_def_and_ext): Add state argument.  If SET_DEST doesn't
	have ext_src_mode, see if it has been modified already with the
	right kind of extension and has been extended before from the
	ext_src_mode.  If SET_DEST is already wider or equal to cand->mode,
	just return true.  Remember the original mode in state->modified
	array.
	(combine_reaching_defs): Add state argument.  Don't allocate and
	free here def_list, copied_list and vec vectors, instead just
	VEC_truncate the vectors in *state.  Don't handle outcome == 2
	here.
	(find_and_remove_re): Set DF_DEFER_INSN_RESCAN df flag.
	Add state variable, clear vectors in it, initialize state.modified
	if needed.  Free all the vectors at the end and state.modified too.
	Don't skip a candidate if the extension expression has been modified.

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

From-SVN: r183416
parent b3aa0ca8
2012-01-23 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/51933
* ree.c (transform_ifelse): Return true right away if dstreg is
already wider or equal to cand->mode.
(enum ext_modified_kind, struct ext_modified, ext_state): New types.
(make_defs_and_copies_lists): Remove defs_list and copies_list
arguments, add state argument, just truncate state->work_list
instead of always allocating and freeing the vector. Assert that
get_defs succeeds instead of returning 2. Changed return type to
bool.
(merge_def_and_ext): Add state argument. If SET_DEST doesn't
have ext_src_mode, see if it has been modified already with the
right kind of extension and has been extended before from the
ext_src_mode. If SET_DEST is already wider or equal to cand->mode,
just return true. Remember the original mode in state->modified
array.
(combine_reaching_defs): Add state argument. Don't allocate and
free here def_list, copied_list and vec vectors, instead just
VEC_truncate the vectors in *state. Don't handle outcome == 2
here.
(find_and_remove_re): Set DF_DEFER_INSN_RESCAN df flag.
Add state variable, clear vectors in it, initialize state.modified
if needed. Free all the vectors at the end and state.modified too.
Don't skip a candidate if the extension expression has been modified.
2012-01-22 Douglas B Rupp <rupp@gnat.com>
PR target/47096
......
2012-01-23 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/51933
* gcc.c-torture/execute/pr51933.c: New test.
2012-01-22 Douglas B Rupp <rupp@gnat.com>
* gcc.dg/builtins-config.h (HAVE_C99_RUNTIME):
......
/* PR rtl-optimization/51933 */
static signed char v1;
static unsigned char v2[256], v3[256];
__attribute__((noclone, noinline)) void
foo (void)
{
asm volatile ("" : : "g" (&v1), "g" (&v2[0]), "g" (&v3[0]) : "memory");
}
__attribute__((noclone, noinline)) int
bar (const int x, const unsigned short *y, char *z)
{
int i;
unsigned short u;
if (!v1)
foo ();
for (i = 0; i < x; i++)
{
u = y[i];
z[i] = u < 0x0100 ? v2[u] : v3[u & 0xff];
}
z[x] = '\0';
return x;
}
int
main (void)
{
char buf[18];
unsigned short s[18];
unsigned char c[18] = "abcdefghijklmnopq";
int i;
for (i = 0; i < 256; i++)
{
v2[i] = i;
v3[i] = i + 1;
}
for (i = 0; i < 18; i++)
s[i] = c[i];
s[5] |= 0x600;
s[6] |= 0x500;
s[11] |= 0x2000;
s[15] |= 0x500;
foo ();
if (bar (17, s, buf) != 17
|| __builtin_memcmp (buf, "abcdeghhijkmmnoqq", 18) != 0)
__builtin_abort ();
return 0;
}
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