From 364490206eaee4e4da9f66e63169cc0c0ddfe40e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sat, 13 May 2017 23:07:49 +0200 Subject: [PATCH] compare-elim.c (equivalent_reg_at_start): Return NULL_RTX when returned register mode doesn't match original mode. * compare-elim.c (equivalent_reg_at_start): Return NULL_RTX when returned register mode doesn't match original mode. From-SVN: r248009 --- gcc/ChangeLog | 7 ++++++- gcc/compare-elim.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b144a538bef..9ec0a530f3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,7 +1,12 @@ +2017-05-13 Uros Bizjak + + * compare-elim.c (equivalent_reg_at_start): Return NULL_RTX + when returned register mode doesn't match original mode. + 2017-05-12 Jeff Law Jakub Jelinek - * config/mn10300/mn10300.c (mn10300_match_ccmode): Fix where + * config/mn10300/mn10300.c (mn10300_match_ccmode): Fix where we look for cc setter after the compare-elim changes. * config/mn10300/mn10300.md (addsi3_flags): Fix order of patterns within the vector to match what compare-elim now expects. diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c index 69b1de73ba8..b5ce99341f6 100644 --- a/gcc/compare-elim.c +++ b/gcc/compare-elim.c @@ -526,6 +526,7 @@ maybe_select_cc_mode (struct comparison *cmp, rtx a ATTRIBUTE_UNUSED, static rtx equivalent_reg_at_start (rtx reg, rtx_insn *end, rtx_insn *start) { + machine_mode orig_mode = GET_MODE (reg); rtx_insn *bb_head = BB_HEAD (BLOCK_FOR_INSN (end)); for (rtx_insn *insn = PREV_INSN (end); @@ -572,6 +573,9 @@ equivalent_reg_at_start (rtx reg, rtx_insn *end, rtx_insn *start) return NULL_RTX; } + if (GET_MODE (reg) != orig_mode) + return NULL_RTX; + return reg; }