Re: x86/include/asm/arch_hweight.h:49:15: error: invalid input size for constraint 'D'

Nathan Chancellor
2023-02-07T16:37:42Z

On Tue, Feb 07, 2023 at 05:30:38PM +0100, Borislav Petkov wrote:
> On Tue, Feb 07, 2023 at 09:28:58AM -0700, Nathan Chancellor wrote:
> > Thanks a lot for the report as always! Looks like there is a fix pending
> > on the list:
> >
> > https://lore.kernel.org/Y+IsCWQdXEr8d9Vy@linutronix.de/
>
> Btw, while I have you, do you know why clang isn't DCOing this chunk
> like gcc does?

Clang does its semantic analysis before optimization, so it cannot dead
code eliminate that chunk before it checks the validity of the asm
constraints, that is just how the pipeline is structured as far as I
understand it. That is one of the biggest and longest standing
differences between clang and GCC that we know about, the upstream link
in the issue below has some more info.

https://github.com/ClangBuiltLinux/linux/issues/3

I am not super familiar with the internal details of LLVM and clang as
other folks are though so I could be wrong or missing something :)

Cheers,
Nathan