see.c (see_def_extension_not_merged): Use copy_rtx_if_shared to avoid invalid sharing.

2008-05-28  Rafael Espindola  <espindola@google.com>

	* see.c (see_def_extension_not_merged): Use copy_rtx_if_shared to avoid
	invalid sharing.

2008-05-28  Rafael Espindola  <espindola@google.com>

	* gcc.dg/20080528-1.c: New test.

From-SVN: r136115
This commit is contained in:
Rafael Avila de Espindola 2008-05-28 16:20:25 +00:00 committed by Rafael Espindola
parent acca98c08f
commit 5a976da002
4 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-05-28 Rafael Espindola <espindola@google.com>
* see.c (see_def_extension_not_merged): Use copy_rtx_if_shared to avoid
invalid sharing.
2008-05-28 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36339

View File

@ -2554,6 +2554,17 @@ see_def_extension_not_merged (struct see_ref_s *curr_ref_s, rtx def_se)
/* The manipulation succeeded. Store the new manipulated reference. */
/* It is possible for dest_reg to appear multiple times in ref_copy. In this
case, ref_copy now has invalid sharing. Copying solves the problem.
We don't use copy_rtx as an optimization for the common case (no sharing).
We can't just use copy_rtx_if_shared since it does nothing on INSNs.
Another possible solution would be to make validate_replace_rtx_1
public and use it instead of replace_rtx. */
reset_used_flags (PATTERN (ref_copy));
reset_used_flags (REG_NOTES (ref_copy));
PATTERN (ref_copy) = copy_rtx_if_shared (PATTERN (ref_copy));
REG_NOTES (ref_copy) = copy_rtx_if_shared (REG_NOTES (ref_copy));
/* Try to simplify the new manipulated insn. */
validate_simplify_insn (ref_copy);

View File

@ -1,3 +1,7 @@
2008-05-28 Rafael Espindola <espindola@google.com>
* gcc.dg/20080528-1.c: New test.
2008-05-28 Arnaud Charlet <charlet@adacore.com>
* gnat.dg/old_errors.adb, gnat.dg/deep_old.adb: Adjust.

View File

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fsee" } */
unsigned long g(int a, int b) {
return a / b;
}
unsigned long f(long int a) {
return g(a, 1<<13);
}