[llvm-dev] Missing attribute kind check in AttrBuilder?

Jonathan Smith via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 20 12:42:09 PST 2020


Greetings everyone,

I have some code that checks for a number of different attributes
assigned to a particular function parameter via
`llvm::AttrBuilder::hasAttributes`; one of these attributes is the
`byval` attribute. Prior to the addition of type attributes, this
worked fine. Since upgrading to 11, I'm getting an assertion failure.

I think the issue is here:

https://github.com/llvm/llvm-project/blob/9211da4215b6d48c8b9186b78274946789c559e9/llvm/lib/IR/Attributes.cpp#L1841

There is no check for `isTypeAttribute()`. If I add that check to the
if-statement, everything works fine again.

The trouble is I don't know if this is a real bug or if there is a
legitimate reason for omitting this check (and, therefore, I'm doing
something I shouldn't be.)

I was just wondering if I can get a second set (or sets) of eyes for a
confirmation/denial of my suspicions.

- Jon


More information about the llvm-dev mailing list