Implemented metric that gets biggest function's size (#182632)
This metric gets the size of the biggest function.
This commit is contained in:
parent
9146da3a7b
commit
a8f3c97d3a
@ -24,6 +24,8 @@ using namespace llvm;
|
||||
STATISTIC(TotalInsts, "Number of instructions (of all types)");
|
||||
STATISTIC(TotalBlocks, "Number of basic blocks");
|
||||
STATISTIC(TotalFuncs, "Number of non-external functions");
|
||||
STATISTIC(LargestFunctionSize,
|
||||
"Largest number of instructions in a single function");
|
||||
|
||||
#define HANDLE_INST(N, OPCODE, CLASS) \
|
||||
STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts");
|
||||
@ -34,7 +36,10 @@ namespace {
|
||||
class InstCount : public InstVisitor<InstCount> {
|
||||
friend class InstVisitor<InstCount>;
|
||||
|
||||
void visitFunction(Function &F) { ++TotalFuncs; }
|
||||
void visitFunction(Function &F) {
|
||||
++TotalFuncs;
|
||||
LargestFunctionSize.updateMax(F.getInstructionCount());
|
||||
}
|
||||
void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; }
|
||||
|
||||
#define HANDLE_INST(N, OPCODE, CLASS) \
|
||||
|
||||
@ -7,15 +7,15 @@
|
||||
; RUN: opt -stats -O3 -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -stats -O0 -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK-DAG: 18 instcount - Largest number of instructions in a single function
|
||||
; CHECK-DAG: 8 instcount - Number of Br insts
|
||||
; CHECK-DAG: 6 instcount - Number of Call insts
|
||||
; CHECK-DAG: 2 instcount - Number of ICmp insts
|
||||
; CHECK-DAG: 1 instcount - Number of Ret insts
|
||||
; CHECK-DAG: 2 instcount - Number of Ret insts
|
||||
; CHECK-DAG: 1 instcount - Number of Switch insts
|
||||
; CHECK-DAG: 10 instcount - Number of basic blocks
|
||||
; CHECK-DAG: 1 instcount - Number of non-external functions
|
||||
; CHECK-DAG: 18 instcount - Number of instructions (of all types)
|
||||
|
||||
; CHECK-DAG: 11 instcount - Number of basic blocks
|
||||
; CHECK-DAG: 2 instcount - Number of non-external functions
|
||||
; CHECK-DAG: 19 instcount - Number of instructions (of all types)
|
||||
|
||||
define void @foo(i32 %i, i32 %j, i32 %n) {
|
||||
entry:
|
||||
@ -61,6 +61,10 @@ if.end4:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @woo() {
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @f()
|
||||
declare void @g()
|
||||
declare void @h()
|
||||
Loading…
x
Reference in New Issue
Block a user