[PATCH] D105407: [LangRef] Add elementtype attribute

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 13:02:03 PDT 2021


nikic added a comment.

In D105407#2860515 <https://reviews.llvm.org/D105407#2860515>, @dblaikie wrote:

> General thought: This seems unfortunately open-ended & could be used to used more generally in a way that might defeat some of the goals of the opaque pointers work (eg: if this gets added to arbitrary functions/used by transformations, etc).

I think there's not a lot of danger of this being misused, at least in-tree, simply due to the fact that clang is not going to emit this attribute for normal pointer arguments. It's only going to be added by IRBuilder for some intrinsic calls, e.g. in IRBuilderBase::CreatePreserveArrayAccessIndex() .

> Could/should we limit this to only apply to intrinsics?

That said, limiting it to intrinsics makes sense to me. For the future I have another possible use in mind with inlineasm+memsanitizer, but we can expand as needed later.

> And can we possibly make it so this is not visible on the function decl, so transformations can't accidentally start depending on its presence (this attribute only really describes a feature of the implementation of the function, right? Not any requirement on callers about how they call such a function (they could pass in whatever pointer they like/doesn't really matter what it points to))

Not sure I quite understand what you mean here. But if you're suggesting that this attribute should only be allowed on call arguments, but not on function parameters, then yes, that makes sense to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105407/new/

https://reviews.llvm.org/D105407



More information about the llvm-commits mailing list