All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Heiko Carstens' <hca@linux.ibm.com>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: "Jens Axboe" <axboe@kernel.dk>,
	"Stefan Haberland" <sth@linux.ibm.com>,
	"Jan Höppner" <hoeppner@linux.ibm.com>,
	"Peter Oberparleiter" <oberpar@linux.ibm.com>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>
Subject: RE: [PATCH 1/1] s390/dasd: fix string length handling
Date: Tue, 29 Aug 2023 08:32:09 +0000	[thread overview]
Message-ID: <51f70b0ad37f469a93242db9cfc6d9e8@AcuMS.aculab.com> (raw)
In-Reply-To: <20230829074854.7031-A-hca@linux.ibm.com>

From: Heiko Carstens
> Sent: 29 August 2023 08:49
> 
> On Mon, Aug 28, 2023 at 03:51:00PM -0700, Nick Desaulniers wrote:
> > On Mon, Aug 28, 2023 at 05:18:37PM +0000, David Laight wrote:
> > > From: Heiko Carstens
> > > > Sent: 28 August 2023 16:32
> > > >  	if (strlen(uid.vduit) > 0)
> > >
> > > Does the compiler know enough to optimise that brain-dead test?
> > >
> >
> > For the purposes of skipping diagnostics, no; clang performs semantic
> > analysis BEFORE optimization (which is handled by LLVM). As such, clang
> > will produce diagnostics on dead code.
> >
> > Partly because LLVM isn't very ergonomic at emitting diagnostics from
> > the backend, partly because Clang code owner and developers don't want
> > clang to emit diagnostics dependent on optimization level.
> >
> > I disagree with my compatriots, and you can read more thoughts here:
> > https://discourse.llvm.org/t/rfc-improving-clangs-middle-and-back-end-
> diagnostics/69261?u=nickdesaulniers
> 
> Maybe I misunderstand what you write above, however clang (latest+greatest)
> does indeed optimize the strlen() away and generates code which only tests
> if uid.vduit[0] is zero or not.
> 
> Unlike gcc, which does not optimize this away and which uses the strlen()
> inline assembly provided via string.h...

And, if -ffreestanding is set (as in some kernel builds), the compiler
can't assume what strlen() does.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2023-08-29  8:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 15:31 [PATCH 0/1] s390/dasd: fix string length handling Heiko Carstens
2023-08-28 15:31 ` [PATCH 1/1] " Heiko Carstens
2023-08-28 17:18   ` David Laight
2023-08-28 22:51     ` Nick Desaulniers
2023-08-29  7:48       ` Heiko Carstens
2023-08-29  8:32         ` David Laight [this message]
2023-08-29 15:39           ` Nick Desaulniers
2023-08-29 15:42         ` Nick Desaulniers
2023-08-28 22:46   ` Nick Desaulniers
2023-08-28 22:53     ` Nick Desaulniers
2023-08-29  8:02     ` Heiko Carstens
2023-08-29 15:41       ` Nick Desaulniers
2023-09-01 13:38   ` Heiko Carstens
2023-09-01 13:47 ` [PATCH 0/1] " Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51f70b0ad37f469a93242db9cfc6d9e8@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=axboe@kernel.dk \
    --cc=hca@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=ndesaulniers@google.com \
    --cc=oberpar@linux.ibm.com \
    --cc=sth@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.