aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2013-02-07 08:07:04 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-02-07 08:07:04 +0000
commit73dd3123ffc080a6104a01a08a8234fbdc83bac5 (patch)
tree33510bb58a15436c9c5742765116481061bd5673 /gcc/cse.c
parente3936f47f63c128d6a667596111865f35869392f (diff)
downloadgcc-73dd3123ffc080a6104a01a08a8234fbdc83bac5.zip
gcc-73dd3123ffc080a6104a01a08a8234fbdc83bac5.tar.gz
gcc-73dd3123ffc080a6104a01a08a8234fbdc83bac5.tar.bz2
re PR rtl-optimization/56178 (Miscompilation of Ada front-end with profiled bootstrap)
PR rtl-optimization/56178 * cse.c (cse_insn): Do not create a REG_EQUAL note if the source is a SUBREG of a register. Tidy up related block of code. * fwprop.c (forward_propagate_and_simplify): Do not create a REG_EQUAL note if the source is a register or a SUBREG of a register. From-SVN: r195841
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 32bed42..b200fef 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5311,33 +5311,33 @@ cse_insn (rtx insn)
}
/* If this is a single SET, we are setting a register, and we have an
- equivalent constant, we want to add a REG_NOTE. We don't want
- to write a REG_EQUAL note for a constant pseudo since verifying that
- that pseudo hasn't been eliminated is a pain. Such a note also
- won't help anything.
+ equivalent constant, we want to add a REG_EQUAL note if the constant
+ is different from the source. We don't want to do it for a constant
+ pseudo since verifying that this pseudo hasn't been eliminated is a
+ pain; moreover such a note won't help anything.
Avoid a REG_EQUAL note for (CONST (MINUS (LABEL_REF) (LABEL_REF)))
which can be created for a reference to a compile time computable
entry in a jump table. */
-
- if (n_sets == 1 && src_const && REG_P (dest)
+ if (n_sets == 1
+ && REG_P (dest)
+ && src_const
&& !REG_P (src_const)
- && ! (GET_CODE (src_const) == CONST
- && GET_CODE (XEXP (src_const, 0)) == MINUS
- && GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF))
+ && !(GET_CODE (src_const) == SUBREG
+ && REG_P (SUBREG_REG (src_const)))
+ && !(GET_CODE (src_const) == CONST
+ && GET_CODE (XEXP (src_const, 0)) == MINUS
+ && GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
+ && GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF)
+ && !rtx_equal_p (src, src_const))
{
- /* We only want a REG_EQUAL note if src_const != src. */
- if (! rtx_equal_p (src, src_const))
- {
- /* Make sure that the rtx is not shared. */
- src_const = copy_rtx (src_const);
+ /* Make sure that the rtx is not shared. */
+ src_const = copy_rtx (src_const);
- /* Record the actual constant value in a REG_EQUAL note,
- making a new one if one does not already exist. */
- set_unique_reg_note (insn, REG_EQUAL, src_const);
- df_notes_rescan (insn);
- }
+ /* Record the actual constant value in a REG_EQUAL note,
+ making a new one if one does not already exist. */
+ set_unique_reg_note (insn, REG_EQUAL, src_const);
+ df_notes_rescan (insn);
}
/* Now deal with the destination. */