* [m32c] fix overzealous peephole
@ 2008-11-12 16:42 DJ Delorie
0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2008-11-12 16:42 UTC (permalink / raw)
To: gcc-patches
Committed.
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.
Index: config/m32c/cond.md
===================================================================
--- config/m32c/cond.md (revision 141786)
+++ config/m32c/cond.md (working copy)
@@ -297,22 +297,25 @@
(const_int -1))))]
"TARGET_A24"
"sceq\t%0\n\tbmgt\t1,%h0\n\tdec.w\t%0"
[(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" "")
(if_then_else:HI (lt (reg:CC FLG_REGNO) (const_int 0))
(const_int -1)
(if_then_else:HI (eq (reg:CC FLG_REGNO) (const_int 0))
(const_int 0)
(const_int -1))))
(set (reg:CC FLG_REGNO)
(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)]
"")
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-12 16:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-12 16:42 [m32c] fix overzealous peephole DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).