diff options
author | Rafael Avila de Espindola <espindola@google.com> | 2008-05-28 16:20:25 +0000 |
---|---|---|
committer | Rafael Espindola <espindola@gcc.gnu.org> | 2008-05-28 16:20:25 +0000 |
commit | 5a976da002caf3838a1f986098ce655fb881efb8 (patch) | |
tree | fc4f9f2657619badbd0209749b23cc7d6c178ea1 /gcc | |
parent | acca98c08fb5c522fb2b830ed61a6d2b53415ae1 (diff) | |
download | gcc-5a976da002caf3838a1f986098ce655fb881efb8.zip gcc-5a976da002caf3838a1f986098ce655fb881efb8.tar.gz gcc-5a976da002caf3838a1f986098ce655fb881efb8.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/see.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20080528-1.c | 9 |
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43e61a6..fe82a48 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7533e37..c548a7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/20080528-1.c b/gcc/testsuite/gcc.dg/20080528-1.c new file mode 100644 index 0000000..9fe9780 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20080528-1.c @@ -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); +} |