[llvm] 12389e3 - [MachineOutliner] Add statistics for unsigned vector size
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 18:26:00 PST 2022
Author: Jessica Paquette
Date: 2022-02-17T18:25:51-08:00
New Revision: 12389e375811d46ce41d949857f8b469d6563114
URL: https://github.com/llvm/llvm-project/commit/12389e375811d46ce41d949857f8b469d6563114
DIFF: https://github.com/llvm/llvm-project/commit/12389e375811d46ce41d949857f8b469d6563114.diff
LOG: [MachineOutliner] Add statistics for unsigned vector size
Useful for debugging + evaluating improvements to the outliner.
Stats are the number of illegal, legal, and invisible instructions in the
unsigned vector, and it's total length.
Added:
Modified:
llvm/lib/CodeGen/MachineOutliner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index d7d098278d2a5..7ce655dce8e34 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -82,9 +82,17 @@ using namespace llvm;
using namespace ore;
using namespace outliner;
+// Statistics for outlined functions.
STATISTIC(NumOutlined, "Number of candidates outlined");
STATISTIC(FunctionsCreated, "Number of functions created");
+// Statistics for instruction mapping.
+STATISTIC(NumLegalInUnsignedVec, "Number of legal instrs in unsigned vector");
+STATISTIC(NumIllegalInUnsignedVec,
+ "Number of illegal instrs in unsigned vector");
+STATISTIC(NumInvisible, "Number of invisible instrs in unsigned vector");
+STATISTIC(UnsignedVecSize, "Size of unsigned vector");
+
// Set to true if the user wants the outliner to run on linkonceodr linkage
// functions. This is false by default because the linker can dedupe linkonceodr
// functions. Since the outliner is confined to a single module (modulo LTO),
@@ -188,6 +196,8 @@ struct InstructionMapper {
assert(LegalInstrNumber != DenseMapInfo<unsigned>::getTombstoneKey() &&
"Tried to assign DenseMap tombstone or empty key to instruction.");
+ // Statistics.
+ ++NumLegalInUnsignedVec;
return MINumber;
}
@@ -215,6 +225,8 @@ struct InstructionMapper {
InstrListForMBB.push_back(It);
UnsignedVecForMBB.push_back(IllegalInstrNumber);
IllegalInstrNumber--;
+ // Statistics.
+ ++NumIllegalInUnsignedVec;
assert(LegalInstrNumber < IllegalInstrNumber &&
"Instruction mapping overflow!");
@@ -293,6 +305,7 @@ struct InstructionMapper {
case InstrType::Invisible:
// Normally this is set by mapTo(Blah)Unsigned, but we just want to
// skip this instruction. So, unset the flag here.
+ ++NumInvisible;
AddedIllegalLastTime = false;
break;
}
@@ -905,6 +918,9 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M,
// MBB is suitable for outlining. Map it to a list of unsigneds.
Mapper.convertToUnsignedVec(MBB, *TII);
}
+
+ // Statistics.
+ UnsignedVecSize = Mapper.UnsignedVec.size();
}
}
More information about the llvm-commits
mailing list