[PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in <cstring>

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 17:18:05 PDT 2015


----- Original Message -----
> From: "Dan Albert via cfe-commits" <cfe-commits at lists.llvm.org>
> To: "Marshall Clow" <mclow.lists at gmail.com>
> Cc: "Joerg Sonnenberger" <joerg at britannica.bec.de>, "cfe-commits" <cfe-commits at lists.llvm.org>
> Sent: Wednesday, August 12, 2015 6:03:30 PM
> Subject: Re: [PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in
> <cstring>
> 
> 
> 
> My testing was varied. I could not get GCC or clang to optimize it
> away for Linux, but both did for ARM Android.
> 
> 
> Regardless, the fact that GCC is already doing this doesn't mean it's
> desirable. We end up hunting and fixing bugs from this optimization
> this every release, and our time could be better spent.

I could say the same thing about many optimizations -- I spend a lot of time tracking down bugs they expose -- the real thing to investigate here are the potential benefits to real code from performing the optimization. I'm generally in favor of these kinds of optimizations because they tend to lower abstraction penalties, but actual data here would be helpful.

What would also be helpful is properly supporting -fno-delete-null-pointer-checks.

 -Hal

> 
> On Wed, Aug 12, 2015 at 3:42 PM, Marshall Clow via cfe-commits <
> cfe-commits at lists.llvm.org > wrote:
> 
> On Tue, Aug 11, 2015 at 2:28 PM, Joerg Sonnenberger via cfe-commits <
> cfe-commits at lists.llvm.org > wrote:
> 
> 
> On Tue, Aug 11, 2015 at 02:06:58PM -0700, Marshall Clow via
> cfe-commits wrote:
> > On Tue, Aug 11, 2015 at 1:34 PM, Dan Albert < danalbert at google.com
> > > wrote:
> > 
> > > Yeah, those sound like exactly what we want. Helping people find
> > > UB is
> > > good, but optimizing assuming we've fixed all of the UB isn't
> > > something we
> > > can do.
> > > 
> > 
> > Dan -- that's the situation you're in today.
> > GCC has done that kind of optimization for *years*.
> 
> Only on platforms that use this markup. Which is exactly the point I
> am
> raising. The gain by this optimisation is questionable at best and it
> has created (or exposed, however you want to call it) non-trivial
> bugs
> in the real world. There is a reason why there is a lot of push back
> outside glibc for this markers.
> 
> 
> 
> 
> I don't think that this is true.
> 
> 
> My tests (from a previous message - run on a Mac, which does not use
> glibc) show that gcc recognizes this and optimizes based on that.
> 
> 
> -- Marshall
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory


More information about the cfe-commits mailing list