[PATCH] D90529: Allow nonnull attribute to accept poison
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 03:59:54 PST 2020
aqjune added a comment.
I tried to fix Attributor to propagate nonnull/align only when there is noundef, but couldn't: https://godbolt.org/z/Yzsc14
Where should I start?
In D90529#2450746 <https://reviews.llvm.org/D90529#2450746>, @nlopes wrote:
> If we allow partial undef pointers to be dereferenced, then it's nearly impossible to derive `noundef` for pointers. So we will have to rely on frontends to annotate. So the question is whether there's any benefit of allowing such accesses and whether that breaks any frontend if not. Can't think of any reason to allow them and that thread doesn't really provide any either AFAICT.
I agree that any frontend won't emit undef when compiling a valid program, but I think the point is that the semantics requires a transformation that hoists a memory instruction to prove that the pointer isn't partially undef, which isn't done by LLVM now.
void f(i64 %offset) {
p = alloca [16 x i8]
assume(0 <= offset < 16)
init(p)
for (..) {
v = load p[offset] // if offset is partially undef, this load cannot be hoisted out of the loop
use(v)
}
}
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