Skip to content

Conversation

svkeerthy
Copy link
Contributor

No description provided.

@svkeerthy svkeerthy changed the title Change [NFC][IR2Vec] Change getSlotIndex parameter from Value* to Value& Aug 27, 2025
@svkeerthy svkeerthy marked this pull request as ready for review August 27, 2025 21:22
@llvmbot llvmbot added mlgo llvm:analysis Includes value tracking, cost tables and constant folding labels Aug 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 27, 2025

@llvm/pr-subscribers-mlgo

@llvm/pr-subscribers-llvm-analysis

Author: S. VenkataKeerthy (svkeerthy)

Changes

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

3 Files Affected:

  • (modified) llvm/include/llvm/Analysis/IR2Vec.h (+1-1)
  • (modified) llvm/lib/Analysis/IR2Vec.cpp (+3-3)
  • (modified) llvm/unittests/Analysis/IR2VecTest.cpp (+4-4)
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h
index c42ca779e097c..d9a07f73a4068 100644
--- a/llvm/include/llvm/Analysis/IR2Vec.h
+++ b/llvm/include/llvm/Analysis/IR2Vec.h
@@ -227,7 +227,7 @@ class Vocabulary {
   /// or OperandKind in the vocabulary.
   LLVM_ABI static unsigned getSlotIndex(unsigned Opcode);
   LLVM_ABI static unsigned getSlotIndex(Type::TypeID TypeID);
-  LLVM_ABI static unsigned getSlotIndex(const Value *Op);
+  LLVM_ABI static unsigned getSlotIndex(const Value &Op);
 
   /// Accessors to get the embedding for a given entity.
   LLVM_ABI const ir2vec::Embedding &operator[](unsigned Opcode) const;
diff --git a/llvm/lib/Analysis/IR2Vec.cpp b/llvm/lib/Analysis/IR2Vec.cpp
index 565ec2a6287b7..21dc2e6530d2c 100644
--- a/llvm/lib/Analysis/IR2Vec.cpp
+++ b/llvm/lib/Analysis/IR2Vec.cpp
@@ -282,8 +282,8 @@ unsigned Vocabulary::getSlotIndex(Type::TypeID TypeID) {
   return MaxOpcodes + static_cast<unsigned>(getCanonicalTypeID(TypeID));
 }
 
-unsigned Vocabulary::getSlotIndex(const Value *Op) {
-  unsigned Index = static_cast<unsigned>(getOperandKind(Op));
+unsigned Vocabulary::getSlotIndex(const Value &Op) {
+  unsigned Index = static_cast<unsigned>(getOperandKind(&Op));
   assert(Index < MaxOperandKinds && "Invalid OperandKind");
   return MaxOpcodes + MaxCanonicalTypeIDs + Index;
 }
@@ -297,7 +297,7 @@ const Embedding &Vocabulary::operator[](Type::TypeID TypeID) const {
 }
 
 const ir2vec::Embedding &Vocabulary::operator[](const Value &Arg) const {
-  return Vocab[getSlotIndex(&Arg)];
+  return Vocab[getSlotIndex(Arg)];
 }
 
 StringRef Vocabulary::getVocabKeyForOpcode(unsigned Opcode) {
diff --git a/llvm/unittests/Analysis/IR2VecTest.cpp b/llvm/unittests/Analysis/IR2VecTest.cpp
index 9f5428758d64c..9c106329b2195 100644
--- a/llvm/unittests/Analysis/IR2VecTest.cpp
+++ b/llvm/unittests/Analysis/IR2VecTest.cpp
@@ -507,23 +507,23 @@ TEST(IR2VecVocabularyTest, SlotIdxMapping) {
 #define EXPECTED_VOCAB_OPERAND_SLOT(X)                                         \
   MaxOpcodes + MaxCanonicalTypeIDs + static_cast<unsigned>(X)
   // Test Function operand
-  EXPECT_EQ(Vocabulary::getSlotIndex(F),
+  EXPECT_EQ(Vocabulary::getSlotIndex(*F),
             EXPECTED_VOCAB_OPERAND_SLOT(Vocabulary::OperandKind::FunctionID));
 
   // Test Constant operand
   Constant *C = ConstantInt::get(Type::getInt32Ty(Ctx), 42);
-  EXPECT_EQ(Vocabulary::getSlotIndex(C),
+  EXPECT_EQ(Vocabulary::getSlotIndex(*C),
             EXPECTED_VOCAB_OPERAND_SLOT(Vocabulary::OperandKind::ConstantID));
 
   // Test Pointer operand
   BasicBlock *BB = BasicBlock::Create(Ctx, "entry", F);
   AllocaInst *PtrVal = new AllocaInst(Type::getInt32Ty(Ctx), 0, "ptr", BB);
-  EXPECT_EQ(Vocabulary::getSlotIndex(PtrVal),
+  EXPECT_EQ(Vocabulary::getSlotIndex(*PtrVal),
             EXPECTED_VOCAB_OPERAND_SLOT(Vocabulary::OperandKind::PointerID));
 
   // Test Variable operand (function argument)
   Argument *Arg = F->getArg(0);
-  EXPECT_EQ(Vocabulary::getSlotIndex(Arg),
+  EXPECT_EQ(Vocabulary::getSlotIndex(*Arg),
             EXPECTED_VOCAB_OPERAND_SLOT(Vocabulary::OperandKind::VariableID));
 #undef EXPECTED_VOCAB_OPERAND_SLOT
 }

@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from 0a36370 to 1ad2eb0 Compare August 27, 2025 21:23
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch from fe1463e to d70182f Compare August 28, 2025 19:59
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch 2 times, most recently from e788f65 to c783a53 Compare August 28, 2025 23:04
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch from d70182f to 01b9019 Compare August 28, 2025 23:04
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch from 01b9019 to 2fd070b Compare August 28, 2025 23:53
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch 2 times, most recently from bcff777 to bd7c537 Compare August 29, 2025 00:37
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch 2 times, most recently from 2dd49e7 to a73389b Compare August 29, 2025 18:51
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from bd7c537 to dc257e4 Compare August 29, 2025 18:53
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch from a73389b to 3c6e312 Compare August 29, 2025 20:07
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from dc257e4 to 49b6cf1 Compare August 29, 2025 20:09
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch 3 times, most recently from a53c559 to e727d58 Compare August 29, 2025 21:06
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-25-canonicalized_type branch from e727d58 to cb881b6 Compare August 29, 2025 21:30
Base automatically changed from users/svkeerthy/08-25-canonicalized_type to main August 29, 2025 21:56
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from 49b6cf1 to a9e6f04 Compare August 29, 2025 21:59
Copy link

graphite-app bot commented Aug 29, 2025

Merge activity

  • Aug 29, 9:59 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Aug 29, 10:33 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 10:39 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 10:44 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 10:47 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 10:50 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 10:59 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 11:02 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 11:14 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 11:19 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 11:21 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 29, 11:54 PM UTC: @svkeerthy merged this pull request with Graphite.

@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch 8 times, most recently from 607f632 to 98a6e5e Compare August 29, 2025 23:14
@boomanaiden154
Copy link
Contributor

@svkeerthy This is stuck in a rebase loop. You probably want to cancel the merge in Graphite and restart it once CI has completed.

@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from 98a6e5e to 06550cf Compare August 29, 2025 23:18
@svkeerthy svkeerthy force-pushed the users/svkeerthy/08-27-change branch from 06550cf to 95de30e Compare August 29, 2025 23:21
@svkeerthy svkeerthy merged commit 27f06dd into main Aug 29, 2025
9 checks passed
@svkeerthy svkeerthy deleted the users/svkeerthy/08-27-change branch August 29, 2025 23:54
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/23465

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (194 of 2313)
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (195 of 2313)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (196 of 2313)
PASS: lldb-api :: commands/memory/read/TestMemoryRead.py (197 of 2313)
UNSUPPORTED: lldb-api :: commands/platform/sdk/TestPlatformSDK.py (198 of 2313)
PASS: lldb-api :: commands/platform/connect/TestPlatformConnect.py (199 of 2313)
PASS: lldb-api :: commands/plugin/TestPlugin.py (200 of 2313)
PASS: lldb-api :: commands/platform/process/launch/TestPlatformProcessLaunch.py (201 of 2313)
PASS: lldb-api :: commands/platform/process/list/TestProcessList.py (202 of 2313)
UNRESOLVED: lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py (203 of 2313)
******************** TEST 'lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads -p TestGuiSpawnThreads.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 27f06dd6a7a978e9a88cecfba926e50f16a1c7c3)
  clang revision 27f06dd6a7a978e9a88cecfba926e50f16a1c7c3
  llvm revision 27f06dd6a7a978e9a88cecfba926e50f16a1c7c3
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
======================================================================
ERROR: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 151, in wrapper
    return func(*args, **kwargs)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py", line 44, in test_gui
    self.child.expect_exact(f"thread #{i + 2}: tid =")
  File "/usr/local/lib/python3.10/dist-packages/pexpect/spawnbase.py", line 432, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0xff6007a0dab0>
command: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb
args: ['/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb', '--no-lldbinit', '--no-use-colors', '-O', 'settings clear --all', '-O', 'settings set symbols.enable-external-lookup false', '-O', 'settings set target.inherit-tcc true', '-O', 'settings set target.disable-aslr false', '-O', 'settings set target.detach-on-error false', '-O', 'settings set target.auto-apply-fixits false', '-O', 'settings set plugin.process.gdb-remote.packet-timeout 60', '-O', 'settings set symbols.clang-modules-cache-path "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api"', '-O', 'settings set use-color false', '-O', 'settings set show-statusline false', '--file', '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/commands/gui/spawn-threads/TestGuiSpawnThreads.test_gui/a.out']
buffer (last 100 chars): b''
before (last 100 chars): b'2 0x0000b77e9a804fb0 _start (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb+0x44fb0)\n'
after: <class 'pexpect.exceptions.EOF'>

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.

4 participants