Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1276645

Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines

From Nicolas Pitre <nicolas.pitre@linaro.org>
Newsgroups linux.kernel
Subject Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines
Date 2015-11-24 17:50 +0100
Message-ID <qyoX0-2d3-17@gated-at.bofh.it> (permalink)
References <qvDfP-6Ck-15@gated-at.bofh.it> <qy20p-4cV-9@gated-at.bofh.it> <qyeuC-3Si-7@gated-at.bofh.it> <qylPt-cQ-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 24 Nov 2015, Arnd Bergmann wrote:

> On Tuesday 24 November 2015 00:37:17 Nicolas Pitre wrote:
> > OK... I produced a minimal test case. I think gcc is screwed. And it is 
> > not a question of __builtin_constant_p being best effort. The resulting 
> > code is plain wrong where a variable is suddenly turned into a constant 
> > of value 0. Any random modification to various part of the code just 
> > makes it disappear but I didn't check the disassembly to see if it is 
> > then correct.
> > 
> > And the good news(tm) is that the same bug is triggered with x86 gcc as 
> > well.
> > 
> > Please try the attached test case.
> 
> I can confirm the behavior you see with gcc-4.9 and later (I only saw
> it on 5.x or later with the kernel code). 

It is really sensitive to code modifications. You simplify it somehow 
and the bug is gone.  So there might be some kind of complexity threshold 
that gcc-4.9 didn't reach with the kernel code.

> It seems to have been
> introduced with
> 
> https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=206941
> 
> 
>         PR tree-optimization/59597
>         * tree-ssa-threadupdate.c (dump_jump_thread_path): Move to earlier
>         in file.  Accept new argument REGISTERING and use it to modify
>         dump output appropriately.
>         (register_jump_thread): Corresponding changes.
>         (mark_threaded_blocks): Reinstate code to cancel unprofitable
>         thread paths involving joiner blocks.  Add code to dump cancelled
>         jump threading paths.
>     
>         PR tree-optimization/59597
>         * gcc.dg/tree-ssa/pr59597.c: New test.
>     
>     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206941 138bc75d-0d04-0410-961f-82ee72b054a4
> 
>  gcc/ChangeLog                           |  11 +++++
>  gcc/testsuite/ChangeLog                 |   5 +++
>  gcc/testsuite/gcc.dg/tree-ssa/pr59597.c |  55 +++++++++++++++++++++++++
>  gcc/tree-ssa-threadupdate.c             | 125 +++++++++++++++++++++++++++++++++++++++------------------
>  4 files changed, 157 insertions(+), 39 deletions(-)
> 
> however, in that version, the -DHIDE_THE_BUG variant also fails:
> 
> compilation that works:
> gcc-cross -Wall -I /home/arnd/git/buildall/arm/gcc/gcc/include  -O2 -c -o /home/arnd/git/buildall/arm/gcc_testcase/src.o /home/arnd/git/buildall/arm/gcc_testcase/src.c -DHIDE_THE_BUG
> /home/arnd/git/buildall/arm/gcc_testcase/src.c: In function 'il_send_rxon_timing':
> /home/arnd/git/buildall/arm/gcc_testcase/src.c:39:30: error: call to '____ilog2_NaN' declared with attribute error: gcc is screwed

IMHO the fact that the -DHIDE_THE_BUG case is enough to make the bug go 
away sometimes is even more worrisome given the nature of the 
"workaround".

Given you have a good handle with the bad commits already, are you going 
to bring it up with the gcc people?


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-17 02:30 +0100
  Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-19 17:30 +0100
    Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-20 01:30 +0100
      Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-20 13:30 +0100
        Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-20 14:30 +0100
  Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-22 23:20 +0100
    Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-22 23:30 +0100
      Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-23 09:00 +0100
        Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-23 16:00 +0100
          Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-23 17:10 +0100
            Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-23 17:20 +0100
              Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-23 17:40 +0100
              Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-24 06:40 +0100
                Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on 32-bit machines Arnd Bergmann <arnd@arndb.de> - 2015-11-24 14:30 +0100
                Re: [GIT PULL] optimize 64-by-32 ddivision for constant divisors on  32-bit machines Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-24 17:50 +0100

csiph-web