[PATCH] D109397: [AttributeList] Change indexes in AttributeList::AttrIndex

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 15:26:48 PDT 2021


aeubanks created this revision.
Herald added subscribers: dexonsmith, jdoerfert, arphaman, hiraditya.
aeubanks added reviewers: dexonsmith, rnk.
aeubanks published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The indexes used in AttributeList's methods are very confusing. The
index used for the function was (unsigned) -1, return value 0, and the
arguments 1+. When iterating through indexes, we rely on unsigned
wrapping.

This changes the function index to 0, return value index to 1, and
arguments to 2+.

There are two places we have to keep the old indexes. One is the C API,
and the other is reading/writing bitcode for backwards compatibility.

If this breaks any downstream users, inspect calls to
*AttributeAtIndex() to see if they've hardcoded indexes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109397

Files:
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Core.cpp
  llvm/unittests/IR/AttributesTest.cpp
  llvm/utils/TableGen/CodeGenTarget.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109397.371204.patch
Type: text/x-patch
Size: 15200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210907/18f69526/attachment.bin>


More information about the llvm-commits mailing list