This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch,AVR]: Fix PR49903
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Denis Chertykov <chertykov at gmail dot com>, Anatoly Sokolov <aesok at post dot ru>, Eric Weddington <eric dot weddington at atmel dot com>
- Date: Fri, 12 Aug 2011 18:53:14 -0400 (EDT)
- Subject: Re: [Patch,AVR]: Fix PR49903
- References: <4E43F9CA.70404@gjlay.de>
On Thu, 11 Aug 2011, Georg-Johann Lay wrote:
> 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.
A glance at AVR makes me think this should already be handled by
the NOTICE_UPDATE_CC machinery. Any analysis why this doesn't
happen? With the same test-case (at -Os) I don't see redundant
compares for cris-elf, for example.
brgds, H-P