This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [patch] Disable if_conversion2 for Og



> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: Tuesday, April 15, 2014 4:05 PM
> To: Joey Ye
> Cc: GCC Patches
> Subject: Re: [patch] Disable if_conversion2 for Og
> 
> On Tue, Apr 15, 2014 at 3:59 AM, Joey Ye <joey.ye@arm.com> wrote:
> > If-converstion is harmful to optimized debugging as it generates
> > conditional execution instructions with line number information, which
> > resulted in a dillusion to developers that both then-else branches are
> executed.
> >
> > For example:
> > test.c:
> > 1: unsigned oldest_sequence;
> > 2:
> > 3: unsigned foo(unsigned seq_number)
> > 4: {
> > 5:  if ((seq_number + 5) < 10)
> > 6:    seq_number += 100;
> > 7:   else
> > 8:     seq_number = oldest_sequence;
> >
> >   if (seq_number < oldest_sequence)
> >     seq_number = oldest_sequence;
> >
> >  return seq_number;
> > }
> >
> > $ arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -Og -g3
> > gets:
> >         .loc 1 5 0
> >         adds    r3, r0, #5
> >         cmp     r3, #9
> >         .loc 1 6 0       <----- line 6, then branch
> >         itee    ls
> >         addls   r0, r0, #100
> > .LVL1:
> >         .loc 1 8 0       <----- line 8, else branch. Both branches seems to
> > be executed in GDB
> >         ldrhi   r3, .L5
> >         ldrhi   r0, [r3]
> >
> > The reason is that if_conversion2 is still enabled in Og. The patch
> > simply disables it for Og.
> >
> > Tests:
> > * -Og bootstrap passed.
> > * Make check default (no additional option): No regression.
> > * Make check with -Og: expected regressions. Cases relying on
> > if-conversion2 failed.
> >> FAIL: gcc.target/arm/its.c scan-assembler-times \\tit 2
> >> FAIL: gcc.target/arm/pr40956.c scan-assembler-times mov[\\\\t ]*r.,
> >> #0 1
> >> FAIL: gcc.target/arm/thumb-ifcvt-2.c scan-assembler asreq
> >> FAIL: gcc.target/arm/thumb-ifcvt-2.c scan-assembler lslne
> >> FAIL: gcc.target/arm/thumb-ifcvt.c scan-assembler asrne
> >> FAIL: gcc.target/arm/thumb-ifcvt.c scan-assembler lslne
> >
> > OK to trunk and 4.8/4.9 branch?
> 
> Ok for trunk and branches after a while.  Why does if-conversion not have
> the same problem?  On the GIMPLE part we avoid all kinds of if-conversion
> with -Og.
I think if-conversion should be disabled for Og too, but I don't have a case to show that it is harmful. If GIMPLE avoids all if-conversion, it is nature to do the same for RTL. I'll test and send another patch to also disable if-conversion.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]