]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cond.md (cond_to_int peephole2): Don't eliminate the insns if the intermediate value...
authorDJ Delorie <dj@redhat.com>
Wed, 12 Nov 2008 16:35:03 +0000 (11:35 -0500)
committerDJ Delorie <dj@gcc.gnu.org>
Wed, 12 Nov 2008 16:35:03 +0000 (11:35 -0500)
* config/m32c/cond.md (cond_to_int peephole2): Don't eliminate the
insns if the intermediate value will be used later.

From-SVN: r141788

gcc/ChangeLog
gcc/config/m32c/cond.md

index 7617fa7eaf0170f184952023576aa6bf4780f6d0..dcfedb13cd52efe284b90d26c658cc2f0b3f70f5 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-12  DJ Delorie  <dj@redhat.com>
+
+       * config/m32c/cond.md (cond_to_int peephole2): Don't eliminate the
+       insns if the intermediate value will be used later.
+
 2008-11-12  Andreas Schwab  <schwab@suse.de>
 
        * config/m68k/m68k.c (print_operand): Mask off extra extension
index a01efe9efa93c83a3428f9caecb9f2c869b036c4..a64d3cafcc682ecb6250996670f87cf16c4317a3 100644 (file)
   [(set_attr "flags" "x")]
   )  
 
-;; A cond_to_int followed by a compare against zero is essentially a no-op.
+;; A cond_to_int followed by a compare against zero is essentially a
+;; no-op.  However, the result of the cond_to_int may be used by later
+;; insns, so make sure it's dead before deleting its set.
 
 (define_peephole2
   [(set (match_operand:HI 0 "mra_qi_operand" "")
        (compare (match_operand:HI 1 "mra_qi_operand" "")
                 (const_int 0)))
    ]
-  "rtx_equal_p(operands[0], operands[1])"
+  "rtx_equal_p (operands[0], operands[1])
+     && dead_or_set_p (peep2_next_insn (1), operands[0])"
   [(const_int 1)]
   "")