From 8f826fe7233b97c58365252f78cb0f08288e9e06 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 19 Aug 2022 14:19:24 -0700 Subject: [PATCH] Fix reverse-iteration buildbot. A couple of instances of iterating over maps snuck in while the bot was down; fix them to use maps with deterministic iteration. --- llvm/lib/CodeGen/GlobalMerge.cpp | 3 ++- llvm/lib/ProfileData/RawMemProfReader.cpp | 4 ++-- llvm/test/tools/llvm-profdata/memprof-inline.test | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp index f5833d3..d65506d 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 2423fd3..8a30855 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 bba6b1e..88c56a9 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 -- 2.7.4