From 1d7cbdfc3d28d5db078b4a214f73b5bc633bdfbb Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 31 May 2017 14:24:06 +0000 Subject: Fix assertion when merging multiple empty AttributeLists Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D33627 llvm-svn: 304300 --- llvm/lib/IR/Attributes.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/IR/Attributes.cpp') diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 19b7c302723..a6d1c9035af 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1006,6 +1006,10 @@ AttributeList AttributeList::get(LLVMContext &C, for (AttributeList List : Attrs) MaxSize = std::max(MaxSize, List.getNumAttrSets()); + // If every list was empty, there is no point in merging the lists. + if (MaxSize == 0) + return AttributeList(); + SmallVector NewAttrSets(MaxSize); for (unsigned I = 0; I < MaxSize; ++I) { AttrBuilder CurBuilder; -- cgit v1.2.3