[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA2zVHocx8PNKk=Uxuh=nv6hO-w+u2hkWhsTPeWxLB_sNQ+bRg@mail.gmail.com>
Date: Thu, 05 Apr 2018 17:47:42 +0000
From: James Y Knight <jyknight@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mka@...omium.org, Linus Torvalds <torvalds@...ux-foundation.org>,
arnd@...db.de, Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
tglx@...utronix.de, Andrew Morton <akpm@...ux-foundation.org>,
Chandler Carruth <chandlerc@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...gle.com>, groeck@...omium.org,
Greg Hackmann <ghackmann@...gle.com>,
gregkh@...uxfoundation.org
Subject: Re: [GIT PULL] x86/build changes for v4.17
I think maybe you're confused; those functions do not appear to use
__builtin_constant_p, which is the issue at hand. Clang's optimizer is of
course not a complete joke...it can perfectly well optimize functions after
inlining in order to not generate "shit code gen".
GCC, however, mixes up the concept of a C "constant expression" with the
results of running optimization passes such as inlining for its
definition/implementation of __builtin_constant_p. Clang does not, and
quite likely will not ever, do that.
That said, I do believe there are ongoing discussions as to how to best
provide a useful alternative which is less semantically strange, and not
too difficult for to conditionally adopt for a gcc/clang-compatible
codebase such as the kernel.
On Thu, Apr 5, 2018 at 3:20 AM Peter Zijlstra <peterz@...radead.org> wrote:
> On Wed, Apr 04, 2018 at 04:31:11PM -0700, Matthias Kaehlcke wrote:
> > From some experiments it looks like clang, in difference to gcc, does
> > not treat constant values passed as parameters to inline function as
> > constants.
> Then you're also missing a heap of optimizations in code like
> rb_erase_augmented() which is specifically constructed to take advantage
> of constant propagation like that.
> Other sites where we expect that to happen is __mutex_lock_common(),
> __update_load_sum() and a bunch of others. There isn't strictly a bug
> here, but not doing that constant propagation will still result in shit
> code gen.
Powered by blists - more mailing lists