[flang] flang-omp-report replace std::map with llvm::DenseMap

This patch replaces the uses of std::map with llvm::DenseMap in the
flang-omp-report plugin. It also removed the 'constructClauseCount' map
due to no longer being needed after the plugin was stripped down.
This is a one of several patches focusing on switching containers from STL to LLVM's ADT library.

Reviewed By: kiranchandramohan, clementval

Differential Revision: https://reviews.llvm.org/D111977
This commit is contained in:
Josh Mottley 2021-10-20 07:56:56 +00:00 committed by Andrzej Warzynski
parent 660c511e5b
commit e9fe8ef4b0
2 changed files with 2 additions and 7 deletions

View File

@ -252,14 +252,10 @@ void OpenMPCounterVisitor::PostClauseCommon(const ClauseInfo &ci) {
if (ci.clause == "nowait") { if (ci.clause == "nowait") {
assert(curLoopLogRecord && assert(curLoopLogRecord &&
"loop Construct should be visited before a nowait clause"); "loop Construct should be visited before a nowait clause");
constructClauseCount[std::make_pair(
curLoopLogRecord->construct, ci.clause)]++;
curLoopLogRecord->clauses.push_back(ci); curLoopLogRecord->clauses.push_back(ci);
} else { } else {
assert(!ompWrapperStack.empty() && assert(!ompWrapperStack.empty() &&
"Construct should be visited before clause"); "Construct should be visited before clause");
constructClauseCount[std::make_pair(
getName(*ompWrapperStack.back()), ci.clause)]++;
clauseStrings[ompWrapperStack.back()].push_back(ci); clauseStrings[ompWrapperStack.back()].push_back(ci);
} }
} }

View File

@ -13,11 +13,11 @@
#include "flang/Parser/parse-tree.h" #include "flang/Parser/parse-tree.h"
#include "flang/Parser/parsing.h" #include "flang/Parser/parsing.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include <deque> #include <deque>
#include <map>
#include <string> #include <string>
namespace Fortran { namespace Fortran {
@ -86,7 +86,6 @@ struct OpenMPCounterVisitor {
void Post(const DoConstruct &); void Post(const DoConstruct &);
std::string clauseDetails{""}; std::string clauseDetails{""};
std::map<std::pair<std::string, std::string>, int> constructClauseCount;
// curLoopLogRecord and loopLogRecordStack store // curLoopLogRecord and loopLogRecordStack store
// pointers to this datastructure's entries. Hence a // pointers to this datastructure's entries. Hence a
@ -99,7 +98,7 @@ struct OpenMPCounterVisitor {
LogRecord *curLoopLogRecord{nullptr}; LogRecord *curLoopLogRecord{nullptr};
llvm::SmallVector<LogRecord *> loopLogRecordStack; llvm::SmallVector<LogRecord *> loopLogRecordStack;
llvm::SmallVector<OmpWrapperType *> ompWrapperStack; llvm::SmallVector<OmpWrapperType *> ompWrapperStack;
std::map<OmpWrapperType *, llvm::SmallVector<ClauseInfo>> clauseStrings; llvm::DenseMap<OmpWrapperType *, llvm::SmallVector<ClauseInfo>> clauseStrings;
Parsing *parsing{nullptr}; Parsing *parsing{nullptr};
}; };
} // namespace parser } // namespace parser