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

Josh Mottley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 02:35:02 PDT 2021


josh.mottley.arm created this revision.
Herald added a project: Flang.
josh.mottley.arm requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111977

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


Index: flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
===================================================================
--- flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
+++ flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.h
@@ -13,10 +13,10 @@
 #include "flang/Parser/parse-tree.h"
 #include "flang/Parser/parsing.h"
 
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
 #include <deque>
-#include <map>
 #include <string>
 
 namespace Fortran {
@@ -85,7 +85,6 @@
   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
@@ -98,7 +97,7 @@
   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
Index: flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
===================================================================
--- flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
+++ flang/examples/flang-omp-report-plugin/flang-omp-report-visitor.cpp
@@ -250,14 +250,10 @@
   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);
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111977.380317.patch
Type: text/x-patch
Size: 2036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211018/6d6e4e23/attachment.bin>


More information about the llvm-commits mailing list