[PATCH] D124115: [Attributes] Update Attribute::get API to consider zero value for int attributes

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 12:38:03 PDT 2022


anna added a comment.

In D124115#3462855 <https://reviews.llvm.org/D124115#3462855>, @nikic wrote:

> I would prefer to split this into two overloads, one without the uint64_t argument creating an enum attribute and one with creating always an int attribute, and fix up any problematic uses accordingly. The current approach leaves behind a footgun if we start actually using zero values for int attributes (something that we are careful not to do currently).

Actually, yes the overload is a better idea.

> The current approach leaves behind a footgun if we start actually using zero values for int attributes (something that we are careful not to do currently).

I'm confused why we cannot have zero values for int attributes? The change here was to specifically allow zero values for any int attribute (because we have a downstream attribute where the value can be zero). 
Is this a verifier issue - for example, we cannot have `derferenceable_or_null` with 0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124115



More information about the llvm-commits mailing list