http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48441

--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> 2011-04-05 
12:03:38 UTC ---
OK, confirmed that cprop_insn makes the insn deleted, in the second CPROP pass:

Breakpoint 3, one_cprop_pass () at ../../trunk/gcc/cprop.c:1799
1799                    changed |= cprop_insn (insn);
(gdb) p debug_rtx(insn)
(jump_insn 214 213 303 29 (set (pc)
        (if_then_else (eq (reg/v:SI 202 [ rval ])
                (const_int 7 [0x7]))
            (label_ref:SI 303)
            (pc))) charset.i:106 25 {*pa.md:1330}
     (expr_list:REG_BR_PROB (const_int 9550 [0x254e])
        (nil))
 -> 303)
$12 = void
(gdb) next
1805                    if (! NOTE_P (insn))
(gdb) p debug_rtx(insn)
(jump_insn/v 214 213 303 29 (set (pc)
        (if_then_else (eq (reg/v:SI 202 [ rval ])
                (const_int 7 [0x7]))
            (label_ref:SI 303)
            (pc))) charset.i:106 25 {*pa.md:1330}
     (expr_list:REG_BR_PROB (const_int 9550 [0x254e])
        (nil))
 -> 303)
$13 = void
(gdb)

CPROP finds that rval==22 and folds away the comparsion "(eq (rval==22) (7))"
in cprop_jump, and then goes on to:

  /* If this is now a no-op delete it, otherwise this must be a valid insn.  */
  if (new_rtx == pc_rtx)
    delete_insn (jump);

I also verified that the same occurred before my patch, i.e. we were doing
mark_oprs_set on dead/deleted insns.

I'll submit the patch.

Reply via email to