[llvm] [IPT] Remove ipt.NumInstScanned statistic (PR #168515)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 03:21:11 PST 2025


https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/168515

The NumInstScanned statistic is non-determinstic across multiple identical invocations of LLVM, and leads to noise when trying to diff LLVM statistics with e.g. ./utils/tdiff.py in llvm-test-suite.

My understanding is that it's non-deterministic because the users of IPT's hasSpecialInstructions/isPreceededBySpecialInstruction API aren't deterministic themselves.

This PR removes it and fixes #157598. This is just a small quality-of-life improvement for the ./utils/tdiff.py workflow, but happy to leave the statistic in if others are using it.


>From 9980d8a2ba415aeab352efefad7003f2d1344b38 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Tue, 18 Nov 2025 19:15:00 +0800
Subject: [PATCH] [IPT] Remove ipt.NumInstScanned statistic

The NumInstScanned statistic is non-determinstic across multiple identical invocations of LLVM, and leads to noise when trying to diff LLVM statistics with e.g. ./utils/tdiff.py in llvm-test-suite.

My understanding is that it's non-deterministic because the users of IPT's hasSpecialInstructions/isPreceededBySpecialInstruction API aren't deterministic themselves.

This PR removes it and fixes #157598. This is just a small quality-of-life improvement for the ./utils/tdiff.py workflow, but happy to leave the statistic in if others are using it.
---
 llvm/lib/Analysis/InstructionPrecedenceTracking.cpp | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
index a2a9c94c14ae8..8bebd465ff7d3 100644
--- a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
+++ b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
@@ -19,15 +19,11 @@
 
 #include "llvm/Analysis/InstructionPrecedenceTracking.h"
 #include "llvm/Analysis/ValueTracking.h"
-#include "llvm/ADT/Statistic.h"
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/Support/CommandLine.h"
 
 using namespace llvm;
 
-#define DEBUG_TYPE "ipt"
-STATISTIC(NumInstScanned, "Number of insts scanned while updating ibt");
-
 #ifndef NDEBUG
 static cl::opt<bool> ExpensiveAsserts(
     "ipt-expensive-asserts",
@@ -50,7 +46,6 @@ const Instruction *InstructionPrecedenceTracking::getFirstSpecialInstruction(
   auto [It, Inserted] = FirstSpecialInsts.try_emplace(BB);
   if (Inserted) {
     for (const auto &I : *BB) {
-      NumInstScanned++;
       if (isSpecialInstruction(&I)) {
         It->second = &I;
         break;



More information about the llvm-commits mailing list