[llvm] [llvm-ir2vec] adding function-embedding map API to ir2vec python bindings (PR #177166)
Nishant Sachdeva via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 2 23:45:36 PST 2026
================
@@ -151,6 +151,41 @@ void IR2VecTool::writeEntitiesToStream(raw_ostream &OS) {
OS << Entities[EntityID] << '\t' << EntityID << '\n';
}
+std::pair<const Function *, Embedding>
+IR2VecTool::getFunctionEmbedding(const Function &F, IR2VecKind Kind) const {
+ assert(Vocab && Vocab->isValid() && "Vocabulary not initialized");
+
+ if (F.isDeclaration())
+ return {nullptr, Embedding()};
+
+ auto Emb = Embedder::create(Kind, F, *Vocab);
+ if (!Emb) {
+ return {nullptr, Embedding()};
----------------
nishant-sachdeva wrote:
Nope, that's a miss on my end. Probably a debug artifact that's creeped into the main code.
Accepting this
https://github.com/llvm/llvm-project/pull/177166
More information about the llvm-commits
mailing list