aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-08-27 21:23:03 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-08-27 21:23:03 +0000
commit109374e2fbfc38ae613f693d7f92bfc1beda7e4e (patch)
treec235714f11418b1f758bec2f8e58e51f4d4780f4
parentb7679d96ec58fe7e67cbc535d1e3b055e40ac4f3 (diff)
downloadgcc-109374e2fbfc38ae613f693d7f92bfc1beda7e4e.zip
gcc-109374e2fbfc38ae613f693d7f92bfc1beda7e4e.tar.gz
gcc-109374e2fbfc38ae613f693d7f92bfc1beda7e4e.tar.bz2
emit-rtl.c (set_unique_reg_note): Discard notes with side effects.
gcc/ * emit-rtl.c (set_unique_reg_note): Discard notes with side effects. From-SVN: r214609
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/emit-rtl.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4f4c2f8..2666b24 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-27 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * emit-rtl.c (set_unique_reg_note): Discard notes with side effects.
+
2014-08-27 David Malcolm <dmalcolm@redhat.com>
* rtl.h (JUMP_LABEL_AS_INSN): New.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 6cfaef6..9abe56e 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -5181,6 +5181,14 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
It serves no useful purpose and breaks eliminate_regs. */
if (GET_CODE (datum) == ASM_OPERANDS)
return NULL_RTX;
+
+ /* Notes with side effects are dangerous. Even if the side-effect
+ initially mirrors one in PATTERN (INSN), later optimizations
+ might alter the way that the final register value is calculated
+ and so move or alter the side-effect in some way. The note would
+ then no longer be a valid substitution for SET_SRC. */
+ if (side_effects_p (datum))
+ return NULL_RTX;
break;
default: