[PATCH] D90529: Allow nonnull attribute to accept poison

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 00:35:29 PST 2020


aqjune added a comment.

In D90529#2367050 <https://reviews.llvm.org/D90529#2367050>, @jdoerfert wrote:

> Agreed. So let's go with 1) and we change all the "value attribute" semantics to produce poison on violation.
> We have noundef for the UB case, that was the reason I wanted it ;)

Thank you, glad to hear that moving towards the change!

In D90529#2367050 <https://reviews.llvm.org/D90529#2367050>, @jdoerfert wrote:

> I don't think we should argue this way, at least it should be the last resort. An attribute describes a property, doesn't matter if it is
> nonnull, align, or dereferenceable, it's a property of the value. Now, due to the way things are it is possible to violate
> that property and then we need to define what is happening. If we do this on a case-by-case basis and with specific transformations
> in mind, we will make the IR more complex, the attributes confusing, and in the end non-composeable.

I think the discussion finally falls into which attribute is a value attribute and which is not.
Value attributes should have the same semantics as you said.
Sometimes value attribute and non-value attribute can interact with each other (e.g., `byval` implies `nonnull` unless null is a valid pointer), but such complexity should be only at there.

> FWIW, that is what AAUndefinedBehavior in the Attributor already does, only with `noundef` it will deduce UB for `nonnull null`.

Aha, thanks for the info.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90529



More information about the llvm-commits mailing list