[PATCH] D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 20:03:37 PDT 2018


hfinkel added a comment.

In https://reviews.llvm.org/D48239#1154943, @chandlerc wrote:

> IMO, we really need to add the other attribute to the IR.
>
> If we codify these semantics, we need to stop Clang from using this attribute. But we shouldn't just rip all that code out only to re-add it once the new attribute is in place. I would seem cleaner to add the new attribute with the desired semantics (even if it isn't (yet) wired up to the optimizer) so that we can just switch Clang from one attribute to the other.


I agree.

Also, fortunately, hooking up the new attribute should be easy. llvm::isDereferenceableAndAlignedPointer already takes a context instruction, and if I'm thinking about this correctly, the new attribute behaves like the old attribute so long as the pointer a) hasn't been captured (assuming that freeing a pointer captures it) or b) has been captured but no functions have been called or atomics used, and I'd not bother checking (b) for now, so we just need to call PointerMayBeCapturedBefore (we can later add another attribute to indicate that a function hasn't freed its argument, and then perform bottom-up inference in the usual way, which will make this more precise).


Repository:
  rL LLVM

https://reviews.llvm.org/D48239





More information about the llvm-commits mailing list