[cfe-dev] [llvm-dev] RFC: Implementing -fno-delete-null-pointer-checks in clang

John McCall via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 30 12:05:14 PDT 2018

> On Apr 30, 2018, at 2:58 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> On Mon, Apr 30, 2018 at 11:14 AM, John McCall <rjmccall at apple.com> wrote:
>> The LLVM address space design has pushed well beyond the sensible boundaries
>> of less-is-more and really needs some concerted effort to actually define the expected
>> properties of different address spaces instead of a dozen different engineers applying
>> a "don't do this optimization if the pointer is in a non-zero address space" rule to the
>> optimizer with a shotgun.
>> In fact, if we'd already done that, we wouldn't need any sort of address-space hack
>> to support this request.  We'd just need a very simple audit of the places that check
>> the "are dereferences of the zero address undefined behavior" bit to make sure that
>> they honor it even in address space 0.  But instead that audit will be confused by a
>> thousand places that just bail out for non-zero address spaces without further
>> explanation.
> I agree.  The pattern of bailing out if AddrSpace != 0 is unfortunate.
> We also need to cap the amount of extra semantics that can be put on address
> spaces.  For instance, we should probably never support trapping semantics on
> loads/stores, even via address spaces.

I would say instead that address spaces are not the right way to support trapping
semantics on loads/stores.


More information about the cfe-dev mailing list