[PATCH] D41951: [Attributes] Fix crash when attempting to remove alignment from an attribute list/set

Daniel Neilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 09:25:46 PST 2018


dneilson created this revision.
dneilson added reviewers: rnk, chandlerc, pete, javed.absar, reames.

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.


https://reviews.llvm.org/D41951

Files:
  lib/IR/Attributes.cpp
  unittests/IR/AttributesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41951.129460.patch
Type: text/x-patch
Size: 3764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/163bf281/attachment.bin>


More information about the llvm-commits mailing list