[llvm] edf31b4 - [IPT] Add a statistic to track instructions scanned to answer queries

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 10:59:46 PDT 2021


Author: Philip Reames
Date: 2021-10-08T10:59:35-07:00
New Revision: edf31b4db1be3acdac1204a1c232454af20569e4

URL: https://github.com/llvm/llvm-project/commit/edf31b4db1be3acdac1204a1c232454af20569e4
DIFF: https://github.com/llvm/llvm-project/commit/edf31b4db1be3acdac1204a1c232454af20569e4.diff

LOG: [IPT] Add a statistic to track instructions scanned to answer queries

I'm planning some changes to the invalidation mechanism here, and having a concrete mechanism to track progress is key.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionPrecedenceTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
index e22655510666..9fee57c54b85 100644
--- a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
+++ b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
@@ -19,11 +19,15 @@
 
 #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",
@@ -64,11 +68,13 @@ bool InstructionPrecedenceTracking::isPreceededBySpecialInstruction(
 
 void InstructionPrecedenceTracking::fill(const BasicBlock *BB) {
   FirstSpecialInsts.erase(BB);
-  for (auto &I : *BB)
+  for (auto &I : *BB) {
+    NumInstScanned++;
     if (isSpecialInstruction(&I)) {
       FirstSpecialInsts[BB] = &I;
       return;
     }
+  }
 
   // Mark this block as having no special instructions.
   FirstSpecialInsts[BB] = nullptr;


        


More information about the llvm-commits mailing list