mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
IR: Use SmallVector instead of std::vector of TrackingMDRef
Don't use std::vector<TrackingMDRef>, 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
This commit is contained in:
parent
f75e13b583
commit
9e2408123d
@ -51,7 +51,11 @@ namespace llvm {
|
||||
bool AllowUnresolvedNodes;
|
||||
|
||||
/// Each subprogram's preserved local variables.
|
||||
DenseMap<MDNode *, std::vector<TrackingMDNodeRef>> PreservedVariables;
|
||||
///
|
||||
/// Do not use a std::vector. Some versions of libc++ apparently copy
|
||||
/// instead of move on grow operations, and TrackingMDRef is expensive to
|
||||
/// copy.
|
||||
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> PreservedVariables;
|
||||
|
||||
DIBuilder(const DIBuilder &) = delete;
|
||||
void operator=(const DIBuilder &) = delete;
|
||||
|
@ -107,7 +107,12 @@ class BitcodeReaderMetadataList {
|
||||
bool AnyFwdRefs;
|
||||
unsigned MinFwdRef;
|
||||
unsigned MaxFwdRef;
|
||||
std::vector<TrackingMDRef> 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<TrackingMDRef, 1> MetadataPtrs;
|
||||
|
||||
LLVMContext &Context;
|
||||
public:
|
||||
|
@ -614,7 +614,7 @@ DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
|
||||
|
||||
static DILocalVariable *createLocalVariable(
|
||||
LLVMContext &VMContext,
|
||||
DenseMap<MDNode *, std::vector<TrackingMDNodeRef>> &PreservedVariables,
|
||||
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
|
||||
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, unsigned Flags) {
|
||||
// FIXME: Why getNonCompileUnitScope()?
|
||||
|
Loading…
Reference in New Issue
Block a user