[PATCH] D70749: [InstCombine] do not insert nonnull assumption for undef

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 15:23:56 PST 2019


efriedma added a comment.

In D70749#1766088 <https://reviews.llvm.org/D70749#1766088>, @rnk wrote:

> I think at this point a straight revert of D69477 <https://reviews.llvm.org/D69477> might be preferable.


Agree.

In D70749#1764073 <https://reviews.llvm.org/D70749#1764073>, @nlopes wrote:

> The problem with dropping attributes is that a given function call site, the attributes to be considered are the union of the attributes in the function call and in the callee declaration. We can't rely drop attributes from the callee since some linking later may add them back.


Attributes on a callsite only apply to that call.  For nonnull in particular, that means it doesn't matter what attributes the callee has, as long as the caller guarantees the nonnull-ness.  Attributes don't propagate from the callsite to the function; they only propagate the other way.

I'm pretty sure we ignore the attributes on declarations when we link a module that declares a function with a module that defines that function. We could say that the attributes on the definition always win, even in other contexts like ThinLTO.

Given this, it's possible to have an overall model where nonnull is strong, and it's legal to strip it from definitions, without adding any new IR constructs.  This treatment of declarations is potentially confusing, though...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70749





More information about the llvm-commits mailing list