How aggressive is CSE about removing redundant CC sets?

Kazu Hirata kazu@cs.umass.edu
Sat Feb 14 02:55:00 GMT 2004


Hi,

While converting h8300 port to MODE_CC, I encountered the following
sequence.

;; move r1 to r0, while testing r1
(parallel [(set (reg:SI 0 r0)
                (reg:SI 1 r1))
	   (set (reg:CC 12 cc)
                (compare:CC (reg:SI 1 r1)
			    (const_int 0)))])

;; test r1
(set (reg:CC 12 cc)
     (compare:CC (reg:SI 1 r1)
		 (const_int 0)))

;; jump depending on CC
(set (pc)
     (if_then_else (eq (reg:CC 12 cc)
		       (const_int 0))
		   (label_ref 17)
		   (pc)))

Note that the second insn isn't necessary because the first one does
the same as a side effect of the move insn.  With -O2, the first insn
didn't go away.  Does anybody know how aggressive CSE is about
removing redundant CC sets?

Thanks,

Kazu Hirata



More information about the Gcc mailing list