[llvm-dev] [RFC] Memory region declaration intrinsic

Eli Friedman via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 7 15:07:36 PST 2021


> -----Original Message-----
> From: Roman Lebedev <lebedev.ri at gmail.com>
> Sent: Tuesday, December 7, 2021 2:39 PM
> To: llvm-dev at lists.llvm.org
> Cc: Eli Friedman <efriedma at quicinc.com>; Johannes Doerfert
> <jdoerfert at anl.gov>; Clement Courbet <courbet at google.com>; Nuno Lopes
> <nunoplopes at sapo.pt>; Nikita Popov <nikita.ppv at gmail.com>; Peter
> Collingbourne <peter at pcc.me.uk>; Philip Reames <listmail at philipreames.com>
> Subject: Re: [RFC] Memory region declaration intrinsic
> 
> On Wed, Dec 8, 2021 at 12:57 AM Eli Friedman <efriedma at quicinc.com> wrote:
> >
> > How does this interact with "inbounds" markings on GEPs?  Can the result of a
> non-inbounds GEP point outside the specified region?
> Uh, it's a trick question, isn't it? :)
> 
> Right now I would basically say that "inbounds" markings on GEPs is
> orthogonal here, because this intrinsic simply "clamps" the underlying
> "allocated object".
> (and naturally, you can't unclamp it afterwards *in this def-use chain*)
> 
> I.e. if you go out of the specified bounds with `inbounds` you get
> poison (and i think you can't go back from there?); but if you go
> out of the specified bounds without `inbounds` it's not poison,
> but dereferencing said pointer is still UB.
> 
> Let me know if this isn't a proper answer,
> or if i have talked myself into a corner here :)

This seems fine, sure.  Please update your proposed LangRef patch so this is clear.

-Eli


More information about the llvm-dev mailing list