[Patch,AVR]: Fix PR49903

Georg-Johann Lay avr@gjlay.de
Thu Aug 11 16:54:00 GMT 2011


This is an optimization in machine dependent reorg to
remove redundant comparisons like in

   cc0 = compare (Reg, Num)
   if (cc0 == 0)
     goto L1

   cc0 = compare (Reg, Num)
   if (cc0 > 0)
     goto L2

The second comparison is redundant an can be removed.
Code like this can be seen in binary decision switch/case
expansion.

Passed without regressions.

Ok to install?

Johann


	* PR target/49903
	* config/avr/avr.md (UNSPEC_IDENTITY): New c_enum.
	(branch_unspec): New insn.
	(branch): Beauty farm.
	* config/avr/avr.c (compare_condition): Use JUMP_P.  Test SET_SRC
	to be IF_THEN_ELSE.
	(avr_compare_pattern, avr_reorg_remove_redundant_compare):
	New static functions.
	(avr_reorg): Use them.  Use next_real_insn instead of NEXT_INSN.
	Use CONST_INT_P.  Beauty.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt-cswitch.diff
Type: text/x-patch
Size: 12556 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110811/4781c788/attachment.bin>


More information about the Gcc-patches mailing list