From: Richard Sandiford Date: Wed, 27 Aug 2014 21:23:03 +0000 (+0000) Subject: emit-rtl.c (set_unique_reg_note): Discard notes with side effects. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=109374e2fbfc38ae613f693d7f92bfc1beda7e4e;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f4c2f8d473..2666b243f8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2014-08-27 Richard Sandiford + + * emit-rtl.c (set_unique_reg_note): Discard notes with side effects. + 2014-08-27 David Malcolm * rtl.h (JUMP_LABEL_AS_INSN): New. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 6cfaef6342a..9abe56ed7a7 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: