[PATCH] D135572: [Attributes] Support int attributes with zero value
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 05:07:42 PDT 2022
nikic created this revision.
nikic added reviewers: aeubanks, serge-sans-paille.
Herald added subscribers: jdoerfert, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This regularly comes up as a stumbling stone when adding int attributes: They currently need to be encoded in a way to avoids the zero value.
This adds support for zero-value int attributes by a) making the ctor determine int/enum attribute based on attribute kind, not whether the value is non-zero and b) switching getRawIntAttr() to return an Optional, so that it's possible to distinguish a zero value from non-existence.
https://reviews.llvm.org/D135572
Files:
llvm/include/llvm/IR/Attributes.h
llvm/lib/IR/Attributes.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135572.466472.patch
Type: text/x-patch
Size: 4653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221010/d32a9884/attachment.bin>
More information about the llvm-commits
mailing list