[PATCH] D70789: [Attributor] Remove dereferenceable_or_null when nonull is present

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 11:01:31 PST 2019


uenoku marked an inline comment as done.
uenoku added a comment.

In D70789#1763315 <https://reviews.llvm.org/D70789#1763315>, @lebedev.ri wrote:

> In D70789#1763283 <https://reviews.llvm.org/D70789#1763283>, @jdoerfert wrote:
>
> > LGTM.
> >
> > In D70789#1762474 <https://reviews.llvm.org/D70789#1762474>, @uenoku wrote:
> >
> > > In D70789#1762114 <https://reviews.llvm.org/D70789#1762114>, @jdoerfert wrote:
> > >
> > > > This was a problem for a while now:
> > > >  Can we have a test case to make sure we do not lose information, e.g. `deref_or_null(100) nonnull deref(4)` should not remove the `deref_or_null(100)`.
> > >
> >
>
>
> More generally, we do already merge `deref_or_null(x) deref(y)` -> `deref(max(x, y))` ?


Yes



================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2944-2947
     getAttrs({Attribute::Dereferenceable, Attribute::DereferenceableOrNull},
              Attrs);
     for (const Attribute &Attr : Attrs)
       takeKnownDerefBytesMaximum(Attr.getValueAsInt());
----------------
The max of deref(x) and deref_or_null(y) is taken here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70789/new/

https://reviews.llvm.org/D70789





More information about the llvm-commits mailing list