diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp index f5833d3b9086..d65506d0232f 100644 --- a/llvm/lib/CodeGen/GlobalMerge.cpp +++ b/llvm/lib/CodeGen/GlobalMerge.cpp @@ -62,6 +62,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -181,7 +182,7 @@ namespace { void collectUsedGlobalVariables(Module &M, StringRef Name); /// Keep track of the GlobalVariable that must not be merged away - SmallPtrSet MustKeepGlobalVariables; + SmallSetVector MustKeepGlobalVariables; public: static char ID; // Pass identification, replacement for typeid. diff --git a/llvm/lib/ProfileData/RawMemProfReader.cpp b/llvm/lib/ProfileData/RawMemProfReader.cpp index 2423fd38e9a2..8a30855c79aa 100644 --- a/llvm/lib/ProfileData/RawMemProfReader.cpp +++ b/llvm/lib/ProfileData/RawMemProfReader.cpp @@ -310,7 +310,7 @@ Error RawMemProfReader::mapRawProfileToRecords() { // it that is part of some dynamic allocation context. The location is stored // as a pointer to a symbolized list of inline frames. using LocationPtr = const llvm::SmallVector *; - llvm::DenseMap> + llvm::MapVector> PerFunctionCallSites; // Convert the raw profile callstack data into memprof records. While doing so @@ -378,7 +378,7 @@ Error RawMemProfReader::mapRawProfileToRecords() { // we insert a new entry for callsite data if we need to. auto Result = FunctionProfileData.insert({Id, IndexedMemProfRecord()}); IndexedMemProfRecord &Record = Result.first->second; - for (LocationPtr Loc : I->getSecond()) { + for (LocationPtr Loc : I->second) { Record.CallSites.push_back(*Loc); } } diff --git a/llvm/test/tools/llvm-profdata/memprof-inline.test b/llvm/test/tools/llvm-profdata/memprof-inline.test index bba6b1ec5306..88c56a97b44d 100644 --- a/llvm/test/tools/llvm-profdata/memprof-inline.test +++ b/llvm/test/tools/llvm-profdata/memprof-inline.test @@ -206,16 +206,6 @@ CHECK-NEXT: LineOffset: 0 CHECK-NEXT: Column: 18 CHECK-NEXT: Inline: 0 CHECK-NEXT: - -CHECK-NEXT: FunctionGUID: 15822663052811949562 -CHECK-NEXT: CallSites: -CHECK-NEXT: - -CHECK-NEXT: - -CHECK-NEXT: Function: 15822663052811949562 -CHECK-NEXT: SymbolName: main -CHECK-NEXT: LineOffset: 1 -CHECK-NEXT: Column: 3 -CHECK-NEXT: Inline: 0 -CHECK-NEXT: - CHECK-NEXT: FunctionGUID: 16434608426314478903 CHECK-NEXT: CallSites: CHECK-NEXT: - @@ -225,3 +215,13 @@ CHECK-NEXT: SymbolName: bar CHECK-NEXT: LineOffset: 0 CHECK-NEXT: Column: 19 CHECK-NEXT: Inline: 0 +CHECK-NEXT: - +CHECK-NEXT: FunctionGUID: 15822663052811949562 +CHECK-NEXT: CallSites: +CHECK-NEXT: - +CHECK-NEXT: - +CHECK-NEXT: Function: 15822663052811949562 +CHECK-NEXT: SymbolName: main +CHECK-NEXT: LineOffset: 1 +CHECK-NEXT: Column: 3 +CHECK-NEXT: Inline: 0