[llvm] r226012 - Add support for comdats with names larger than 256 characters.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 14 10:25:45 PST 2015
Author: rafael
Date: Wed Jan 14 12:25:45 2015
New Revision: 226012
URL: http://llvm.org/viewvc/llvm-project?rev=226012&view=rev
Log:
Add support for comdats with names larger than 256 characters.
Added:
llvm/trunk/test/Assembler/large-comdat.ll
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=226012&r1=226011&r2=226012&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Jan 14 12:25:45 2015
@@ -549,11 +549,13 @@ static unsigned getEncodedComdatSelectio
}
static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream) {
- SmallVector<uint8_t, 64> Vals;
+ SmallVector<uint16_t, 64> Vals;
for (const Comdat *C : VE.getComdats()) {
// COMDAT: [selection_kind, name]
Vals.push_back(getEncodedComdatSelectionKind(*C));
- Vals.push_back(C->getName().size());
+ size_t Size = C->getName().size();
+ assert(isUInt<16>(Size));
+ Vals.push_back(Size);
for (char Chr : C->getName())
Vals.push_back((unsigned char)Chr);
Stream.EmitRecord(bitc::MODULE_CODE_COMDAT, Vals, /*AbbrevToUse=*/0);
Added: llvm/trunk/test/Assembler/large-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/large-comdat.ll?rev=226012&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/large-comdat.ll (added)
+++ llvm/trunk/test/Assembler/large-comdat.ll Wed Jan 14 12:25:45 2015
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+$_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_ = comdat any
+
+; CHECK: $_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_ = comdat any
+
+define void @_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_() comdat {
+ ret void
+}
More information about the llvm-commits
mailing list