[PATCH] D105407: [LangRef] Add elementtype attribute
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 7 12:07:46 PDT 2021
nikic added a comment.
In D105407#2860627 <https://reviews.llvm.org/D105407#2860627>, @dblaikie wrote:
>>> 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.
>
> I was thinking the opposite, sort of - only on the function declaration, but if there was some way to make it so they wouldn't be readily observed by analysis/transformations, etc. Really the type is an implementation detail of the function, not part of its signature/not something callers should be observing/making choices based on, I think? But I doubt we have any infrastructure to provide that sort of private implementation detail property for an intrinsic.
I'm still not sure I follow. Optimizations for an intrinsic using elementtype do need to inspect the attribute. It's effectively part of the ABI for that intrinsic.
In D105407#2862125 <https://reviews.llvm.org/D105407#2862125>, @aeubanks wrote:
> if we add it to the function declaration, we'll have issues with mangling right? that's another reason to only have it on the caller
Right. Adding the attribute to the declaration would require including the element type in the intrinsic mangling, as we'd need multiple declarations that only differ by the `elementtype` attribute, rather than types in the signature. Not sure whether doing that would cause any problems.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105407/new/
https://reviews.llvm.org/D105407
More information about the llvm-commits
mailing list