[llvm] [llvm-mca] Abort on parse error without -skip-unsupported-instructions (PR #90474)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 07:01:11 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 86b9a4f892b9fc6cf5929f33a529570acd7abc71 0f8416d4596b8385076e678231bfaf0e16c1f8c8 -- llvm/tools/llvm-mca/CodeRegionGenerator.cpp llvm/tools/llvm-mca/CodeRegionGenerator.h llvm/tools/llvm-mca/llvm-mca.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
index c84d325148..77ab658458 100644
--- a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
+++ b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
@@ -29,7 +29,8 @@ namespace mca {
 CodeRegionGenerator::~CodeRegionGenerator() {}
 
 Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions(
-    const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) {
+    const std::unique_ptr<MCInstPrinter> &IP,
+    bool SkipUnsupportedInstructions) {
   MCTargetOptions Opts;
   Opts.PreserveAsmComments = false;
   CodeRegions &Regions = getRegions();
diff --git a/llvm/tools/llvm-mca/CodeRegionGenerator.h b/llvm/tools/llvm-mca/CodeRegionGenerator.h
index 11fab45629..8fd988bf97 100644
--- a/llvm/tools/llvm-mca/CodeRegionGenerator.h
+++ b/llvm/tools/llvm-mca/CodeRegionGenerator.h
@@ -148,7 +148,8 @@ protected:
   CodeRegionGenerator(const CodeRegionGenerator &) = delete;
   CodeRegionGenerator &operator=(const CodeRegionGenerator &) = delete;
   virtual Expected<const CodeRegions &>
-  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) = 0;
+  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                   bool SkipUnsupportedInstructions) = 0;
 
 public:
   CodeRegionGenerator() {}
@@ -164,7 +165,8 @@ public:
   AnalysisRegionGenerator(llvm::SourceMgr &SM) : Regions(SM) {}
 
   virtual Expected<const AnalysisRegions &>
-  parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) = 0;
+  parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                       bool SkipUnsupportedInstructions) = 0;
 };
 
 /// Abstract CodeRegionGenerator with InstrumentRegionsRegions member
@@ -176,7 +178,8 @@ public:
   InstrumentRegionGenerator(llvm::SourceMgr &SM) : Regions(SM) {}
 
   virtual Expected<const InstrumentRegions &>
-  parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) = 0;
+  parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                         bool SkipUnsupportedInstructions) = 0;
 };
 
 /// This abstract class is responsible for parsing input ASM and
@@ -202,7 +205,8 @@ public:
 
   unsigned getAssemblerDialect() const { return AssemblerDialect; }
   Expected<const CodeRegions &>
-  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) override;
+  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                   bool SkipUnsupportedInstructions) override;
 };
 
 class AsmAnalysisRegionGenerator final : public AnalysisRegionGenerator,
@@ -222,8 +226,10 @@ public:
   MCStreamerWrapper *getMCStreamer() override { return &Streamer; }
 
   Expected<const AnalysisRegions &>
-  parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) override {
-    Expected<const CodeRegions &> RegionsOrErr = parseCodeRegions(IP, SkipUnsupportedInstructions);
+  parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                       bool SkipUnsupportedInstructions) override {
+    Expected<const CodeRegions &> RegionsOrErr =
+        parseCodeRegions(IP, SkipUnsupportedInstructions);
     if (!RegionsOrErr)
       return RegionsOrErr.takeError();
     else
@@ -231,8 +237,10 @@ public:
   }
 
   Expected<const CodeRegions &>
-  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) override {
-    return AsmCodeRegionGenerator::parseCodeRegions(IP, SkipUnsupportedInstructions);
+  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                   bool SkipUnsupportedInstructions) override {
+    return AsmCodeRegionGenerator::parseCodeRegions(
+        IP, SkipUnsupportedInstructions);
   }
 };
 
@@ -254,8 +262,10 @@ public:
   MCStreamerWrapper *getMCStreamer() override { return &Streamer; }
 
   Expected<const InstrumentRegions &>
-  parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) override {
-    Expected<const CodeRegions &> RegionsOrErr = parseCodeRegions(IP, SkipUnsupportedInstructions);
+  parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                         bool SkipUnsupportedInstructions) override {
+    Expected<const CodeRegions &> RegionsOrErr =
+        parseCodeRegions(IP, SkipUnsupportedInstructions);
     if (!RegionsOrErr)
       return RegionsOrErr.takeError();
     else
@@ -263,8 +273,10 @@ public:
   }
 
   Expected<const CodeRegions &>
-  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP, bool SkipUnsupportedInstructions) override {
-    return AsmCodeRegionGenerator::parseCodeRegions(IP, SkipUnsupportedInstructions);
+  parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
+                   bool SkipUnsupportedInstructions) override {
+    return AsmCodeRegionGenerator::parseCodeRegions(
+        IP, SkipUnsupportedInstructions);
   }
 };
 
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index e7b8edc5f1..674a2da551 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -482,7 +482,8 @@ int main(int argc, char **argv) {
   mca::AsmInstrumentRegionGenerator IRG(*TheTarget, SrcMgr, ICtx, *MAI, *STI,
                                         *MCII, *IM);
   Expected<const mca::InstrumentRegions &> InstrumentRegionsOrErr =
-      IRG.parseInstrumentRegions(std::move(IPtemp), SkipUnsupportedInstructions);
+      IRG.parseInstrumentRegions(std::move(IPtemp),
+                                 SkipUnsupportedInstructions);
   if (!InstrumentRegionsOrErr) {
     if (auto Err = handleErrors(InstrumentRegionsOrErr.takeError(),
                                 [](const StringError &E) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/90474


More information about the llvm-commits mailing list