[llvm] de5477e - Add a statistic to track number of times we rebuild instruction ordering

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


Author: Philip Reames
Date: 2021-10-08T10:59:34-07:00
New Revision: de5477ed4255ee59b45c3d71552d89dfe262748f

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

LOG: Add a statistic to track number of times we rebuild instruction ordering

The goal here is to assist some future tuning work both on instruction ordering invalidation, and on some client code which uses it.

Added: 
    

Modified: 
    llvm/lib/IR/BasicBlock.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index d14abafdef2eb..ed1956e0f7e9a 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/IR/BasicBlock.h"
 #include "SymbolTableListTraitsImpl.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/CFG.h"
 #include "llvm/IR/Constants.h"
@@ -23,6 +24,9 @@
 
 using namespace llvm;
 
+#define DEBUG_TYPE "ir"
+STATISTIC(NumInstrRenumberings, "Number of renumberings across all blocks");
+
 ValueSymbolTable *BasicBlock::getValueSymbolTable() {
   if (Function *F = getParent())
     return F->getValueSymbolTable();
@@ -505,6 +509,8 @@ void BasicBlock::renumberInstructions() {
   BasicBlockBits Bits = getBasicBlockBits();
   Bits.InstrOrderValid = true;
   setBasicBlockBits(Bits);
+
+  NumInstrRenumberings++;
 }
 
 #ifndef NDEBUG


        


More information about the llvm-commits mailing list