summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/AttributesTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Attributes] Fix a bug in AttributeList::get so it can handle a mix of ↵Craig Topper2018-04-161-0/+8
| | | | | | | | | | FunctionIndex and ReturnIndex/arg indices at the same time The code uses the index of the last element in the sorted array to determine the maximum size needed for the vector. But if the last index is a FunctionIndex(~0), attrIdxToArrayIdx will return 0 and the vector will have size 1. If there are any indices before FunctionIndex, those values would return a value larger than 0 from attrIdxToArrayIdx. So in this case we need to look in front of the FunctionIndex to get the true size needed. Differential Revision: https://reviews.llvm.org/D45632 llvm-svn: 330136
* [Attributes] Fix crash when attempting to remove alignment from an attribute ↵Daniel Neilson2018-01-171-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | list/set Summary: Discovered while working on a patch to move alignment in @llvm.memcpy/move/set from an arg into parameter attributes. The current implementations of AttributeSet::removeAttribute() and AttributeList::removeAttribute crash when attempting to remove the alignment attribute. Currently, these implementations add the to-be-removed attributes to an AttrBuilder and then remove the builder from the list/set. Alignment is special in that it must be added to a builder with an integer value for the alignment; attempts to add alignment to a builder without a value is an error. This change fixes the removeAttribute implementations for AttributeSet and AttributeList to make them able to remove the alignment, and other similar, attributes. Reviewers: rnk, chandlerc, pete, javed.absar, reames Reviewed By: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41951 llvm-svn: 322735
* Fix assertion when merging multiple empty AttributeListsReid Kleckner2017-05-311-0/+7
| | | | | | | | Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D33627 llvm-svn: 304300
* Fix off-by-one bug in AttributeList::addAttributes index handlingReid Kleckner2017-05-191-0/+19
| | | | | | | | | | getParamAlignment expects an argument number, not an AttributeList index. Johan Englan, who works on LDC, found this bug and told me about it off list. llvm-svn: 303458
* Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Reid Kleckner2017-05-021-1/+1
| | | | | | | | | | AttributeList" This time, I fixed, built, and tested clang. This reverts r301712. llvm-svn: 301981
* Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Hans Wennborg2017-04-281-1/+1
| | | | | | | | | | | | | | | | | | AttributeList" This broke the Clang build. (Clang-side patch missing?) Original commit message: > [IR] Make add/remove Attributes use AttrBuilder instead of > AttributeList > > This change cleans up call sites and avoids creating temporary > AttributeList objects. > > NFC llvm-svn: 301712
* [IR] Make add/remove Attributes use AttrBuilder instead of AttributeListReid Kleckner2017-04-281-1/+1
| | | | | | | | | This change cleans up call sites and avoids creating temporary AttributeList objects. NFC llvm-svn: 301697
* Remove buggy 'addAttributes(unsigned, AttrBuilder)' overloadReid Kleckner2017-04-191-0/+5
| | | | | | | | | | The 'addAttributes(unsigned, AttrBuilder)' overload delegated to 'get' instead of 'addAttributes'. Since we can implicitly construct an AttrBuilder from an AttributeSet, just standardize on AttrBuilder. llvm-svn: 300651
* Fix crash in AttributeList::addAttributes, add testReid Kleckner2017-04-181-0/+9
| | | | llvm-svn: 300614
* Rename AttributeSet to AttributeListReid Kleckner2017-03-211-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is a list of AttributeSetNodes corresponding the function prototype of a call or function declaration. This class used to be called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is typically accessed by parameter and return value index, so "AttributeList" seems like a more intuitive name. Rename AttributeSetImpl to AttributeListImpl to follow suit. It's useful to rename this class so that we can rename AttributeSetNode to AttributeSet later. AttributeSet is the set of attributes that apply to a single function, argument, or return value. Reviewers: sanjoy, javed.absar, chandlerc, pete Reviewed By: pete Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits Differential Revision: https://reviews.llvm.org/D31102 llvm-svn: 298393
* Fix non-determinism in order of LLVM attributesReid Kleckner2016-04-041-0/+9
| | | | | | | | | | | | | | | | | | We were using array_pod_sort on an array of type 'Attribute', which wraps a pointer to AttributeImpl. For the most part this didn't matter because the printing code prints enum attributes in a defined order, but integer attributes such as 'align' and 'dereferenceable' were not ordered. Furthermore, AttributeImpl::operator< was broken for integer attributes. An integer attribute is a kind and an integer value, and both pieces need to be compared. By fixing the comparison operator, we can go back to std::sort, and things look good now. This should fix clang arm-swiftcall.c test failures on Windows. llvm-svn: 265361
* Make one of the AttributeSet ctors maintain the invariant that thePeter Collingbourne2013-08-021-0/+13
| | | | | | | | attribute list is ordered by index. Differential Revision: http://llvm-reviews.chandlerc.com/D1265 llvm-svn: 187682
* Fix test to not use the AttributeSet's AttributeWithIndex creation method.Bill Wendling2013-01-271-5/+5
| | | | llvm-svn: 173608
* Add a unit test to verifies that attribute uniquing works so it doesn't ↵Benjamin Kramer2013-01-121-0/+34
break again. The folding set details can be subtle and broke twice in the last couple of weeks. llvm-svn: 172313
OpenPOWER on IntegriCloud