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

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Wed Oct 20 01:05:23 PDT 2021


Author: Josh Mottley
Date: 2021-10-20T07:57:04Z
New Revision: e9fe8ef4b0aa68be782a9139e08e9337ef79a462

URL: https://github.com/llvm/llvm-project/commit/e9fe8ef4b0aa68be782a9139e08e9337ef79a462
DIFF: https://github.com/llvm/llvm-project/commit/e9fe8ef4b0aa68be782a9139e08e9337ef79a462.diff

LOG: [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

Added: 
    

Modified: 
    flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
    flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h

Removed: 
    


################################################################################
diff  --git a/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp b/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
index ca56e83e88cf..f49e72fabee8 100644
--- a/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
+++ b/flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
@@ -252,14 +252,10 @@ void OpenMPCounterVisitor::PostClauseCommon(const ClauseInfo &ci) {
   if (ci.clause == "nowait") {
     assert(curLoopLogRecord &&
         "loop Construct should be visited before a nowait clause");
-    constructClauseCount[std::make_pair(
-        curLoopLogRecord->construct, ci.clause)]++;
     curLoopLogRecord->clauses.push_back(ci);
   } else {
     assert(!ompWrapperStack.empty() &&
         "Construct should be visited before clause");
-    constructClauseCount[std::make_pair(
-        getName(*ompWrapperStack.back()), ci.clause)]++;
     clauseStrings[ompWrapperStack.back()].push_back(ci);
   }
 }

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


        


More information about the flang-commits mailing list