[PATCH] D90529: Allow nonnull/align attribute to accept poison

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 23:50:22 PST 2021


MaskRay added a comment.

I got a bit confused by the summary until I realized that I should read it this way:) Perhaps you can still edit the summary like the following:

This propagates the nonnull attribute to the caller in the following case:

  %p = gep inbounds %x, 1 ; % p is non-null pointer or poison
  call void @f(%p)        ; instcombine converts this to call void @f(nonnull %p)

<del>Instead, </del>This patch makes it illegal to propagate the nonnull attribute to the caller.

  define void @f(i8* %p) {       ; functionattr cannot mark %p nonnull here anymore
    call void @g(i8* nonnull %p) ; .. because @g never raises UB if it never uses %p.
    ret void
  }

To re-allow nonnull propagation to the caller, the caller should have the noundef attribute.


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