From 3c406c2da52302eb5cced431373f240b9c037841 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 20 Apr 2016 20:14:09 +0000 Subject: IR: Use SmallVector instead of std::vector of TrackingMDRef Don't use std::vector, since (at least in some versions of libc++) std::vector apparently copies values on grow operations instead of moving them. Found this when I was temporarily deleting the copy constructor for TrackingMDRef to investigate a performance bottleneck. llvm-svn: 266909 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 9c65eecad81..ae1f98f0fd6 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -107,7 +107,12 @@ class BitcodeReaderMetadataList { bool AnyFwdRefs; unsigned MinFwdRef; unsigned MaxFwdRef; - std::vector MetadataPtrs; + + /// Array of metadata references. + /// + /// Don't use std::vector here. Some versions of libc++ copy (instead of + /// move) on resize, and TrackingMDRef is very expensive to copy. + SmallVector MetadataPtrs; LLVMContext &Context; public: -- cgit v1.2.3