[PATCH] D90529: Allow nonnull attribute to accept poison
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 11 11:09:41 PST 2020
aqjune added a comment.
Should we have clarification about the semantics of align/nonnull bundle for the assume intrinsic?
When a function call is inlined, the attributes of the parameters may remain as assume's bundles:
call f(nonnull %p)
->
llvm.assume [ "nonnull"(%p) ]
Here are two possible semantics:
1. When `"nonnull"(%p)` is at the operand bundle, there also should be `"noundef"(%p)`, otherwise it is a no-op.
; A correct transformation
call f(nonnull noundef %p)
->
llvm.assume [ "nonnull"(%p), "noundef"(%p) ] ; since noundef and nonnull are both in the bundle, it is UB if %p is null
2. `"nonnull"(%p)` diverges from `nonnull`, and immediately raises UB if `%p` is null. This means that the lowering should be done only when `noundef` existed.
; A correct transformation
call f(nonnull noundef %p)
->
llvm.assume [ "nonnull"(%p) ] ; this is UB if %p is null
The former makes attribute -> op bundle conversion simpler, whereas the latter makes reasoning from op bundle simpler (well, maybe both are simple enough). :)
I think either option is fine.
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