[PATCH] D99100: [WIP] Implement RFC: Decomposing deref(N) into deref(N) + nofree
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 14 18:55:17 PDT 2021
reames added a comment.
@nikic I remember the situation with the parameter attribute. The issue is that the attribute describes actions taken through that particular copy of the pointer, not all copies of the pointer. This makes it easier to infer, but makes it very challenging to use for optimization. As an example, consider the following:
void foo(bool c, char * deref(1) nofree a, char * b) {
loop {
if (c) { free(b); break; }
v = *a;
}
}
foo(true, p, p);
In this example, we'd want to hoist the load from a, but since b can point to the same object, we can't.
This was the motivation for the use of noalias in the original proposal. Review discussion made it quickly clear that there was no consensus as to what noalias actually meant, and I dropped that approach. There might be room to drive that forward, but it'll intersect with all the aliasing work involving the same attribute in complicated ways.
Extending this pointer property to an object property was the notion behind the "nofreeobj" idea. I still think that would work if pursued.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99100/new/
https://reviews.llvm.org/D99100
More information about the llvm-commits
mailing list