Displaying 4 results from an estimated 4 matches for "any_ptr".
2020 Feb 18
8
The semantics of nonnull attribute
...ver, this transformation is incorrect if f(nonnull null) is equivalent
to f(poison).
If f was an empty function, f(nonnull null) never raises UB regardless of
ptr. So we can't guarantee ptr != null at other uses of ptr.
2. InstCombine (https://godbolt.org/z/HDQ7rD ):
%ptr_inb = gep inbounds %any_ptr, 1
f(%ptr_inb)
=>
%ptr_inb = .. (identical)
f(nonnull %ptr_inb)
This optimization is incorrect if `f(nonnull null)` is UB. The reason is as
follows.
If `gep inbounds %any_ptr, 1` yields poison, the source is `f(poison)`
whereas the optimized one is `f(nonnull poison)`.
`f(nonnull poison)` shoul...
2020 Feb 18
2
The semantics of nonnull attribute
...For the given code snipped it is not even invalid to propagate nonnull
in the poison case but your point is not wrong, if we have f(poison) we
cannot derive anything from it if the argument might be unused.
> 2. InstCombine (https://godbolt.org/z/HDQ7rD ):
>
> %ptr_inb = gep inbounds %any_ptr, 1
> f(%ptr_inb)
> =>
> %ptr_inb = .. (identical)
> f(nonnull %ptr_inb)
>
> This optimization is incorrect if `f(nonnull null)` is UB. The reason is as
> follows.
> If `gep inbounds %any_ptr, 1` yields poison, the source is `f(poison)`
> whereas the optimized one is `...
2020 Feb 18
3
The semantics of nonnull attribute
...t even invalid to propagate nonnull
> in the poison case but your point is not wrong, if we have f(poison)
> we cannot derive anything from it if the argument might be unused.
>
>
> > 2. InstCombine (https://godbolt.org/z/HDQ7rD ):
> >
> > %ptr_inb = gep inbounds %any_ptr, 1
> > f(%ptr_inb)
> > =>
> > %ptr_inb = .. (identical)
> > f(nonnull %ptr_inb)
> >
> > This optimization is incorrect if `f(nonnull null)` is UB. The
> > reason is as follows.
> > If `gep inbounds %any_ptr, 1` yields poison, the source is
>...
2020 Feb 18
8
The semantics of nonnull attribute
...nnull
> > in the poison case but your point is not wrong, if we have f(poison)
> > we cannot derive anything from it if the argument might be unused.
> >
> >
> > > 2. InstCombine (https://godbolt.org/z/HDQ7rD ):
> > >
> > > %ptr_inb = gep inbounds %any_ptr, 1
> > > f(%ptr_inb)
> > > =>
> > > %ptr_inb = .. (identical)
> > > f(nonnull %ptr_inb)
> > >
> > > This optimization is incorrect if `f(nonnull null)` is UB. The
> > > reason is as follows.
> > > If `gep inbounds %any_ptr,...