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.
This commit is contained in:
Eli Friedman 2022-08-19 14:19:24 -07:00
parent 175560fc21
commit 8f826fe723
3 changed files with 14 additions and 13 deletions

View File

@ -62,6 +62,7 @@
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -181,7 +182,7 @@ namespace {
void collectUsedGlobalVariables(Module &M, StringRef Name); void collectUsedGlobalVariables(Module &M, StringRef Name);
/// Keep track of the GlobalVariable that must not be merged away /// Keep track of the GlobalVariable that must not be merged away
SmallPtrSet<const GlobalVariable *, 16> MustKeepGlobalVariables; SmallSetVector<const GlobalVariable *, 16> MustKeepGlobalVariables;
public: public:
static char ID; // Pass identification, replacement for typeid. static char ID; // Pass identification, replacement for typeid.

View File

@ -310,7 +310,7 @@ Error RawMemProfReader::mapRawProfileToRecords() {
// it that is part of some dynamic allocation context. The location is stored // it that is part of some dynamic allocation context. The location is stored
// as a pointer to a symbolized list of inline frames. // as a pointer to a symbolized list of inline frames.
using LocationPtr = const llvm::SmallVector<FrameId> *; using LocationPtr = const llvm::SmallVector<FrameId> *;
llvm::DenseMap<GlobalValue::GUID, llvm::SetVector<LocationPtr>> llvm::MapVector<GlobalValue::GUID, llvm::SetVector<LocationPtr>>
PerFunctionCallSites; PerFunctionCallSites;
// Convert the raw profile callstack data into memprof records. While doing so // 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. // we insert a new entry for callsite data if we need to.
auto Result = FunctionProfileData.insert({Id, IndexedMemProfRecord()}); auto Result = FunctionProfileData.insert({Id, IndexedMemProfRecord()});
IndexedMemProfRecord &Record = Result.first->second; IndexedMemProfRecord &Record = Result.first->second;
for (LocationPtr Loc : I->getSecond()) { for (LocationPtr Loc : I->second) {
Record.CallSites.push_back(*Loc); Record.CallSites.push_back(*Loc);
} }
} }

View File

@ -206,16 +206,6 @@ CHECK-NEXT: LineOffset: 0
CHECK-NEXT: Column: 18 CHECK-NEXT: Column: 18
CHECK-NEXT: Inline: 0 CHECK-NEXT: Inline: 0
CHECK-NEXT: - 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: FunctionGUID: 16434608426314478903
CHECK-NEXT: CallSites: CHECK-NEXT: CallSites:
CHECK-NEXT: - CHECK-NEXT: -
@ -225,3 +215,13 @@ CHECK-NEXT: SymbolName: bar
CHECK-NEXT: LineOffset: 0 CHECK-NEXT: LineOffset: 0
CHECK-NEXT: Column: 19 CHECK-NEXT: Column: 19
CHECK-NEXT: Inline: 0 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