Skip to content

Conversation

svkeerthy
Copy link
Contributor

No description provided.

@llvmbot llvmbot added mlgo llvm:analysis Includes value tracking, cost tables and constant folding labels Oct 6, 2025
@svkeerthy svkeerthy requested a review from mtrofin October 6, 2025 21:35
@llvmbot
Copy link
Member

llvmbot commented Oct 6, 2025

@llvm/pr-subscribers-mlgo

@llvm/pr-subscribers-llvm-analysis

Author: S. VenkataKeerthy (svkeerthy)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/162165.diff

1 Files Affected:

  • (modified) llvm/lib/Analysis/IR2Vec.cpp (+2)
diff --git a/llvm/lib/Analysis/IR2Vec.cpp b/llvm/lib/Analysis/IR2Vec.cpp
index 295b6d33525d9..688535161d4b9 100644
--- a/llvm/lib/Analysis/IR2Vec.cpp
+++ b/llvm/lib/Analysis/IR2Vec.cpp
@@ -200,6 +200,8 @@ void Embedder::computeEmbeddings() const {
   if (F.isDeclaration())
     return;
 
+  FuncVector = Embedding(Dimension, 0.0);
+
   // Consider only the basic blocks that are reachable from entry
   for (const BasicBlock *BB : depth_first(&F)) {
     computeEmbeddings(*BB);

@svkeerthy svkeerthy merged commit 3491738 into main Oct 6, 2025
12 checks passed
@svkeerthy svkeerthy deleted the users/svkeerthy/10-06-ir2vec-initialization branch October 6, 2025 22:26
@mtrofin
Copy link
Member

mtrofin commented Oct 7, 2025

what would happen without this (i.e. UB, or?)

@svkeerthy
Copy link
Contributor Author

svkeerthy commented Oct 7, 2025

Without this, if computeEmbeddings() is called twice, the returned function vector would be 2*(actual embedding value).

svkeerthy added a commit that referenced this pull request Oct 7, 2025
…ctor()` and `getInstVecMap()` return same results (#162365)

Tests for #162165. Missed it earlier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding mlgo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants