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
This commit is contained in:
Uros Bizjak 2017-05-13 23:07:49 +02:00
parent 2263019d60
commit 364490206e
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-05-13 Uros Bizjak <ubizjak@gmail.com>
* compare-elim.c (equivalent_reg_at_start): Return NULL_RTX
when returned register mode doesn't match original mode.
2017-05-12 Jeff Law <law@redhat.com> 2017-05-12 Jeff Law <law@redhat.com>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>

View File

@ -526,6 +526,7 @@ maybe_select_cc_mode (struct comparison *cmp, rtx a ATTRIBUTE_UNUSED,
static rtx static rtx
equivalent_reg_at_start (rtx reg, rtx_insn *end, rtx_insn *start) 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)); rtx_insn *bb_head = BB_HEAD (BLOCK_FOR_INSN (end));
for (rtx_insn *insn = PREV_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; return NULL_RTX;
} }
if (GET_MODE (reg) != orig_mode)
return NULL_RTX;
return reg; return reg;
} }