Hi!

On the testcase in the PR (too large and creduce not making sufficient
progress) we ICE because i386.md:
;; Combining simple memory jump instruction

(define_peephole2
  [(set (match_operand:W 0 "register_operand")
        (match_operand:W 1 "memory_operand"))
   (set (pc) (match_dup 0))]
  "!TARGET_X32
   && !ix86_indirect_branch_thunk_register
   && peep2_reg_dead_p (2, operands[0])"
  [(set (pc) (match_dup 1))])

peephole2 triggers on a CROSSING_JUMP_P jump, but nothing actually
copies that bit over from the old to the new JUMP_INSN.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2018-01-15  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/83213
        * recog.c (peep2_attempt): Copy over CROSSING_JUMP_P from peepinsn
        to last if both are JUMP_INSNs.

--- gcc/recog.c.jj      2018-01-09 08:58:14.594002069 +0100
+++ gcc/recog.c 2018-01-15 16:37:13.279196178 +0100
@@ -3446,6 +3446,8 @@ peep2_attempt (basic_block bb, rtx_insn
   last = emit_insn_after_setloc (attempt,
                                 peep2_insn_data[i].insn,
                                 INSN_LOCATION (peepinsn));
+  if (JUMP_P (peepinsn) && JUMP_P (last))
+    CROSSING_JUMP_P (last) = CROSSING_JUMP_P (peepinsn);
   before_try = PREV_INSN (insn);
   delete_insn_chain (insn, peep2_insn_data[i].insn, false);
 

        Jakub

Reply via email to