[llvm] [llvm-mca] Add -skip-unsupported-instructions option (PR #89733)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 03:31:41 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 f89f670d92b5726fc61bf8252a6ecc273086c501 f0494037aeb6b5f3e7df53d9a1228bad0d2e0d01 -- llvm/lib/MCA/InstrBuilder.cpp llvm/tools/llvm-mca/CodeRegion.h llvm/tools/llvm-mca/llvm-mca.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp
index 6261b208ff..2e3ebe3d90 100644
--- a/llvm/lib/MCA/InstrBuilder.cpp
+++ b/llvm/lib/MCA/InstrBuilder.cpp
@@ -542,8 +542,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
   const MCSchedClassDesc &SCDesc = *SM.getSchedClassDesc(SchedClassID);
   if (SCDesc.NumMicroOps == MCSchedClassDesc::InvalidNumMicroOps) {
     return make_error<InstructionError<MCInst>>(
-        "found an unsupported instruction in the input assembly sequence",
-        MCI);
+        "found an unsupported instruction in the input assembly sequence", MCI);
   }
 
   LLVM_DEBUG(dbgs() << "\n\t\tOpcode Name= " << MCII.getName(Opcode) << '\n');
diff --git a/llvm/tools/llvm-mca/CodeRegion.h b/llvm/tools/llvm-mca/CodeRegion.h
index 952eb634b6..bc153c084d 100644
--- a/llvm/tools/llvm-mca/CodeRegion.h
+++ b/llvm/tools/llvm-mca/CodeRegion.h
@@ -59,9 +59,9 @@
 #define LLVM_TOOLS_LLVM_MCA_CODEREGION_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MCA/CustomBehaviour.h"
@@ -98,16 +98,18 @@ public:
     Instructions.emplace_back(Instruction);
   }
 
-  // Remove the given instructions from the set, for unsupported instructions being skipped.
-  // Returns an ArrayRef for the updated vector of Instructions.
+  // Remove the given instructions from the set, for unsupported instructions
+  // being skipped. Returns an ArrayRef for the updated vector of Instructions.
   [[nodiscard]]
-  llvm::ArrayRef<llvm::MCInst> dropInstructions(const llvm::SmallPtrSetImpl<const llvm::MCInst*> &Insts) {
+  llvm::ArrayRef<llvm::MCInst>
+  dropInstructions(const llvm::SmallPtrSetImpl<const llvm::MCInst *> &Insts) {
     if (Insts.empty())
       return Instructions;
     Instructions.erase(std::remove_if(Instructions.begin(), Instructions.end(),
-      [&Insts](const llvm::MCInst &Inst) {
-        return Insts.contains(&Inst);
-      }), Instructions.end());
+                                      [&Insts](const llvm::MCInst &Inst) {
+                                        return Insts.contains(&Inst);
+                                      }),
+                       Instructions.end());
     return Instructions;
   }
 
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 891e578c91..84f998a946 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -579,7 +579,7 @@ int main(int argc, char **argv) {
     DenseMap<const MCInst *, SmallVector<mca::Instrument *>>
         InstToInstruments;
     SmallVector<std::unique_ptr<mca::Instruction>> LoweredSequence;
-    SmallPtrSet<const MCInst*, 16> DroppedInsts;
+    SmallPtrSet<const MCInst *, 16> DroppedInsts;
     for (const MCInst &MCI : Insts) {
       SMLoc Loc = MCI.getLoc();
       const SmallVector<mca::Instrument *> Instruments =
@@ -594,9 +594,14 @@ int main(int argc, char **argv) {
                   std::string InstructionStr;
                   raw_string_ostream SS(InstructionStr);
                   if (SkipUnsupportedInstructions)
-                    WithColor::warning() << IE.Message << ", skipping with -skip-unsupported-instructions, note accuracy will be impacted:\n";
+                    WithColor::warning()
+                        << IE.Message
+                        << ", skipping with -skip-unsupported-instructions, "
+                           "note accuracy will be impacted:\n";
                   else
-                    WithColor::error() << IE.Message << ", use -skip-unsupported-instructions to ignore.";
+                    WithColor::error()
+                        << IE.Message
+                        << ", use -skip-unsupported-instructions to ignore.";
                   IP->printInst(&IE.Inst, 0, "", *STI, SS);
                   SS.flush();
                   WithColor::note()

``````````

</details>


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


More information about the llvm-commits mailing list