[llvm] [MIR2Vec] Added create factory methods for Vocabulary (PR #162569)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 16:15:37 PDT 2025


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/CodeGen/MIR2Vec.h llvm/lib/CodeGen/MIR2Vec.cpp llvm/unittests/CodeGen/MIR2VecTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/CodeGen/MIR2Vec.h b/llvm/include/llvm/CodeGen/MIR2Vec.h
index dbffede50..91fb7744a 100644
--- a/llvm/include/llvm/CodeGen/MIR2Vec.h
+++ b/llvm/include/llvm/CodeGen/MIR2Vec.h
@@ -93,9 +93,7 @@ public:
   /// Get the string key for a vocabulary entry at the given position
   std::string getStringKey(unsigned Pos) const;
 
-  unsigned getDimension() const {
-    return Storage.getDimension();
-  }
+  unsigned getDimension() const { return Storage.getDimension(); }
 
   // Accessor methods
   const Embedding &operator[](unsigned Opcode) const {
@@ -105,26 +103,22 @@ public:
 
   // Iterator access
   using const_iterator = ir2vec::VocabStorage::const_iterator;
-  const_iterator begin() const {
-    return Storage.begin();
-  }
+  const_iterator begin() const { return Storage.begin(); }
 
-  const_iterator end() const {
-    return Storage.end();
-  }
+  const_iterator end() const { return Storage.end(); }
 
   /// Total number of entries in the vocabulary
-  size_t getCanonicalSize() const {
-    return Storage.size();
-  }
+  size_t getCanonicalSize() const { return Storage.size(); }
 
   MIRVocabulary() = delete;
 
   /// Factory method to create MIRVocabulary from vocabulary map
-  static Expected<MIRVocabulary> create(VocabMap &&Entries, const TargetInstrInfo &TII);
-  
+  static Expected<MIRVocabulary> create(VocabMap &&Entries,
+                                        const TargetInstrInfo &TII);
+
   /// Factory method to create MIRVocabulary from existing storage
-  static Expected<MIRVocabulary> create(ir2vec::VocabStorage &&Storage, const TargetInstrInfo &TII);
+  static Expected<MIRVocabulary> create(ir2vec::VocabStorage &&Storage,
+                                        const TargetInstrInfo &TII);
 
 private:
   MIRVocabulary(VocabMap &&Entries, const TargetInstrInfo &TII);

``````````

</details>


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


More information about the llvm-commits mailing list