SuccessChanges

Summary

  1. Allow nonnull/align attribute to accept poison (details)
Commit 4479c0c2c0be019b9932c6f1380a40e6cb48da25 by aqjune
Allow nonnull/align attribute to accept poison

Currently LLVM is relying on ValueTracking's `isKnownNonZero` to attach `nonnull`, which can return true when the value is poison.
To make the semantics of `nonnull` consistent with the behavior of `isKnownNonZero`, this makes the semantics of `nonnull` to accept poison, and return poison if the input pointer isn't null.
This makes many transformations like below legal:

```
%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)
```

Instead, this semantics makes propagation of `nonnull` to caller illegal.
The reason is that, passing poison to `nonnull` does not immediately raise UB anymore, so such program is still well defined, if the callee does not use the argument.
Having `noundef` attribute there re-allows this.

```
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
}
```

Another attribute that needs to be updated is `align`. This patch updates the semantics of align to accept poison as well.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D90529
The file was modifiedllvm/test/Transforms/InstCombine/unused-nonnull.ll
The file was modifiedllvm/docs/LangRef.rst
The file was modifiedllvm/test/Transforms/Attributor/nonnull.ll
The file was modifiedllvm/lib/Transforms/IPO/FunctionAttrs.cpp
The file was modifiedllvm/include/llvm/IR/Argument.h
The file was modifiedllvm/test/Transforms/Attributor/align.ll
The file was modifiedllvm/lib/Analysis/ValueTracking.cpp
The file was modifiedllvm/test/Transforms/InstCombine/call_nonnull_arg.ll
The file was modifiedllvm/lib/IR/Function.cpp
The file was modifiedllvm/test/Transforms/FunctionAttrs/nonnull.ll
The file was modifiedllvm/test/Analysis/ValueTracking/known-nonnull-at.ll