[LiveRangeEdit] Add a statistic variable for rematerialization
authorGuozhi Wei <carrot@google.com>
Fri, 30 Sep 2022 19:39:51 +0000 (19:39 +0000)
committerGuozhi Wei <carrot@google.com>
Fri, 30 Sep 2022 19:39:51 +0000 (19:39 +0000)
Add a statistic variable for rematerialization.

Differential Revision: https://reviews.llvm.org/D134907

llvm/lib/CodeGen/LiveRangeEdit.cpp

index c955c58..afc04f0 100644 (file)
@@ -24,9 +24,10 @@ using namespace llvm;
 
 #define DEBUG_TYPE "regalloc"
 
-STATISTIC(NumDCEDeleted,     "Number of instructions deleted by DCE");
-STATISTIC(NumDCEFoldedLoads, "Number of single use loads folded after DCE");
-STATISTIC(NumFracRanges,     "Number of live ranges fractured by DCE");
+STATISTIC(NumDCEDeleted,        "Number of instructions deleted by DCE");
+STATISTIC(NumDCEFoldedLoads,    "Number of single use loads folded after DCE");
+STATISTIC(NumFracRanges,        "Number of live ranges fractured by DCE");
+STATISTIC(NumReMaterialization, "Number of instructions rematerialized");
 
 void LiveRangeEdit::Delegate::anchor() { }
 
@@ -193,6 +194,8 @@ SlotIndex LiveRangeEdit::rematerializeAt(MachineBasicBlock &MBB,
   // is true.
   (*--MI).getOperand(0).setIsDead(false);
   Rematted.insert(RM.ParentVNI);
+  ++NumReMaterialization;
+
   if (ReplaceIndexMI)
     return LIS.ReplaceMachineInstrInMaps(*ReplaceIndexMI, *MI).getRegSlot();
   return LIS.getSlotIndexes()->insertMachineInstrInMaps(*MI, Late).getRegSlot();