From 3e836a310dd93958129e5b917466c4f11cbabc13 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 1 Feb 2008 21:28:46 +0000 Subject: [PATCH] re PR rtl-optimization/34773 (miscompilation of vfprintf_r) PR rtl-optimization/34773 * reg-notes.def (EQUAL): Mention significance of combination of REG_EQUAL and REG_RETVAL. * fwprop.c (try_fwprop_subst): Don't add REG_EQUAL to an insn that has a REG_RETVAL. From-SVN: r132053 --- gcc/ChangeLog | 8 ++++++++ gcc/fwprop.c | 9 ++++++--- gcc/reg-notes.def | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35f0e75eed2..8bf727f6f41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2008-02-01 Hans-Peter Nilsson + + PR rtl-optimization/34773 + * reg-notes.def (EQUAL): Mention significance of combination of + REG_EQUAL and REG_RETVAL. + * fwprop.c (try_fwprop_subst): Don't add REG_EQUAL to an + insn that has a REG_RETVAL. + 2008-02-01 Roger Sayle PR bootstrap/33781 diff --git a/gcc/fwprop.c b/gcc/fwprop.c index 6bc9c674a76..1e0327230bb 100644 --- a/gcc/fwprop.c +++ b/gcc/fwprop.c @@ -729,9 +729,12 @@ try_fwprop_subst (struct df_ref *use, rtx *loc, rtx new, rtx def_insn, bool set_ { cancel_changes (0); - /* Can also record a simplified value in a REG_EQUAL note, making a - new one if one does not already exist. */ - if (set_reg_equal) + /* Can also record a simplified value in a REG_EQUAL note, + making a new one if one does not already exist. + Don't do this if the insn has a REG_RETVAL note, because the + combined presence means that the REG_EQUAL note refers to the + (full) contents of the libcall value. */ + if (set_reg_equal && !find_reg_note (insn, REG_RETVAL, NULL_RTX)) { if (dump_file) fprintf (dump_file, " Setting REG_EQUAL note\n"); diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def index 36953242e29..eaf04168f5f 100644 --- a/gcc/reg-notes.def +++ b/gcc/reg-notes.def @@ -52,7 +52,9 @@ REG_NOTE (EQUIV) /* Like REG_EQUIV except that the destination is only momentarily equal to the specified rtx. Therefore, it cannot be used for - substitution; but it can be used for cse. */ + substitution; but it can be used for cse. Together with a + REG_RETVAL note, it means that the insn sets the full contents of + the libcall value. */ REG_NOTE (EQUAL) /* This insn copies the return-value of a library call out of the hard