diff options
-rw-r--r-- | compiler/optimizing/boolean_simplifier.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/boolean_simplifier.h | 4 | ||||
-rw-r--r-- | compiler/optimizing/constant_folding.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/constant_folding.h | 6 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/intrinsics.cc | 1 | ||||
-rw-r--r-- | compiler/optimizing/intrinsics.h | 4 | ||||
-rw-r--r-- | compiler/optimizing/licm.cc | 1 | ||||
-rw-r--r-- | compiler/optimizing/licm.h | 5 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler_stats.h | 8 |
11 files changed, 35 insertions, 14 deletions
diff --git a/compiler/optimizing/boolean_simplifier.cc b/compiler/optimizing/boolean_simplifier.cc index f985745e7a..c3e88f39c3 100644 --- a/compiler/optimizing/boolean_simplifier.cc +++ b/compiler/optimizing/boolean_simplifier.cc @@ -36,6 +36,8 @@ void HBooleanSimplifier::TryRemovingNegatedCondition(HBasicBlock* block) { if (!boolean_not->HasUses()) { boolean_not->GetBlock()->RemoveInstruction(boolean_not); } + + MaybeRecordStat(MethodCompilationStat::kBooleanSimplifier); } // Returns true if 'block1' and 'block2' are empty, merge into the same single @@ -146,6 +148,8 @@ void HBooleanSimplifier::TryRemovingBooleanSelection(HBasicBlock* block) { block->MergeWith(false_block); block->MergeWith(merge_block); + MaybeRecordStat(MethodCompilationStat::kBooleanSimplifier); + // No need to update any dominance information, as we are simplifying // a simple diamond shape, where the join block is merged with the // entry block. Any following blocks would have had the join block diff --git a/compiler/optimizing/boolean_simplifier.h b/compiler/optimizing/boolean_simplifier.h index e12a12c95b..0eb6c71c1c 100644 --- a/compiler/optimizing/boolean_simplifier.h +++ b/compiler/optimizing/boolean_simplifier.h @@ -62,8 +62,8 @@ namespace art { class HBooleanSimplifier : public HOptimization { public: - explicit HBooleanSimplifier(HGraph* graph) - : HOptimization(graph, kBooleanSimplifierPassName) {} + HBooleanSimplifier(HGraph* graph, OptimizingCompilerStats* stats) + : HOptimization(graph, kBooleanSimplifierPassName, stats) {} void Run() OVERRIDE; diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc index 57452cc076..1db775ecab 100644 --- a/compiler/optimizing/constant_folding.cc +++ b/compiler/optimizing/constant_folding.cc @@ -68,6 +68,7 @@ void HConstantFolding::Run() { } else { inst->Accept(&simplifier); } + MaybeRecordStat(MethodCompilationStat::kConstantFolding); } else if (inst->IsUnaryOperation()) { // Constant folding: replace `op(a)' with a constant at compile // time if `a' is a constant. @@ -76,6 +77,7 @@ void HConstantFolding::Run() { inst->ReplaceWith(constant); inst->GetBlock()->RemoveInstruction(inst); } + MaybeRecordStat(MethodCompilationStat::kConstantFolding); } else if (inst->IsTypeConversion()) { // Constant folding: replace `TypeConversion(a)' with a constant at // compile time if `a' is a constant. @@ -84,6 +86,7 @@ void HConstantFolding::Run() { inst->ReplaceWith(constant); inst->GetBlock()->RemoveInstruction(inst); } + MaybeRecordStat(MethodCompilationStat::kConstantFolding); } else if (inst->IsDivZeroCheck()) { // We can safely remove the check if the input is a non-null constant. HDivZeroCheck* check = inst->AsDivZeroCheck(); @@ -92,6 +95,7 @@ void HConstantFolding::Run() { check->ReplaceWith(check_input); check->GetBlock()->RemoveInstruction(check); } + MaybeRecordStat(MethodCompilationStat::kConstantFolding); } } } diff --git a/compiler/optimizing/constant_folding.h b/compiler/optimizing/constant_folding.h index 2698b2d690..df893710df 100644 --- a/compiler/optimizing/constant_folding.h +++ b/compiler/optimizing/constant_folding.h @@ -32,8 +32,10 @@ namespace art { */ class HConstantFolding : public HOptimization { public: - explicit HConstantFolding(HGraph* graph, const char* name = kConstantFoldingPassName) - : HOptimization(graph, name) {} + HConstantFolding(HGraph* graph, + OptimizingCompilerStats* stats, + const char* name = kConstantFoldingPassName) + : HOptimization(graph, name, stats) {} void Run() OVERRIDE; diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 0363f203b2..b33f6f2398 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -395,11 +395,11 @@ bool HInliner::TryBuildAndInline(ArtMethod* resolved_method, // Run simple optimizations on the graph. HDeadCodeElimination dce(callee_graph, stats_); - HConstantFolding fold(callee_graph); + HConstantFolding fold(callee_graph, stats_); ReferenceTypePropagation type_propagation(callee_graph, handles_); HSharpening sharpening(callee_graph, codegen_, dex_compilation_unit, compiler_driver_); InstructionSimplifier simplify(callee_graph, stats_); - IntrinsicsRecognizer intrinsics(callee_graph, compiler_driver_); + IntrinsicsRecognizer intrinsics(callee_graph, compiler_driver_, stats_); HOptimization* optimizations[] = { &intrinsics, diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc index b01324ec3b..9516f01c91 100644 --- a/compiler/optimizing/intrinsics.cc +++ b/compiler/optimizing/intrinsics.cc @@ -438,6 +438,7 @@ void IntrinsicsRecognizer::Run() { << invoke->DebugName(); } else { invoke->SetIntrinsic(intrinsic, NeedsEnvironmentOrCache(intrinsic)); + MaybeRecordStat(MethodCompilationStat::kIntrinsicsRecognizer); } } } diff --git a/compiler/optimizing/intrinsics.h b/compiler/optimizing/intrinsics.h index e459516e59..cc4f708116 100644 --- a/compiler/optimizing/intrinsics.h +++ b/compiler/optimizing/intrinsics.h @@ -30,8 +30,8 @@ class DexFile; // Recognize intrinsics from HInvoke nodes. class IntrinsicsRecognizer : public HOptimization { public: - IntrinsicsRecognizer(HGraph* graph, CompilerDriver* driver) - : HOptimization(graph, kIntrinsicsRecognizerPassName), + IntrinsicsRecognizer(HGraph* graph, CompilerDriver* driver, OptimizingCompilerStats* stats) + : HOptimization(graph, kIntrinsicsRecognizerPassName, stats), driver_(driver) {} void Run() OVERRIDE; diff --git a/compiler/optimizing/licm.cc b/compiler/optimizing/licm.cc index c38bbe3477..6d0a616a54 100644 --- a/compiler/optimizing/licm.cc +++ b/compiler/optimizing/licm.cc @@ -123,6 +123,7 @@ void LICM::Run() { UpdateLoopPhisIn(instruction->GetEnvironment(), loop_info); } instruction->MoveBefore(pre_header->GetLastInstruction()); + MaybeRecordStat(MethodCompilationStat::kLICM); } else if (instruction->CanThrow()) { // If `instruction` can throw, we cannot move further instructions // that can throw as well. diff --git a/compiler/optimizing/licm.h b/compiler/optimizing/licm.h index 0b5a0f103b..bf56f53d46 100644 --- a/compiler/optimizing/licm.h +++ b/compiler/optimizing/licm.h @@ -26,8 +26,9 @@ class SideEffectsAnalysis; class LICM : public HOptimization { public: - LICM(HGraph* graph, const SideEffectsAnalysis& side_effects) - : HOptimization(graph, kLoopInvariantCodeMotionPassName), side_effects_(side_effects) {} + LICM(HGraph* graph, const SideEffectsAnalysis& side_effects, OptimizingCompilerStats* stats) + : HOptimization(graph, kLoopInvariantCodeMotionPassName, stats), + side_effects_(side_effects) {} void Run() OVERRIDE; diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 2204921c53..24f0d779d7 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -487,10 +487,10 @@ static void RunOptimizations(HGraph* graph, graph, stats, HDeadCodeElimination::kInitialDeadCodeEliminationPassName); HDeadCodeElimination* dce2 = new (arena) HDeadCodeElimination( graph, stats, HDeadCodeElimination::kFinalDeadCodeEliminationPassName); - HConstantFolding* fold1 = new (arena) HConstantFolding(graph); + HConstantFolding* fold1 = new (arena) HConstantFolding(graph, stats); InstructionSimplifier* simplify1 = new (arena) InstructionSimplifier(graph, stats); - HBooleanSimplifier* boolean_simplify = new (arena) HBooleanSimplifier(graph); - HConstantFolding* fold2 = new (arena) HConstantFolding(graph, "constant_folding_after_inlining"); + HBooleanSimplifier* boolean_simplify = new (arena) HBooleanSimplifier(graph, stats); + HConstantFolding* fold2 = new (arena) HConstantFolding(graph, stats, "constant_folding_after_inlining"); SideEffectsAnalysis* side_effects = new (arena) SideEffectsAnalysis(graph); GVNOptimization* gvn = new (arena) GVNOptimization(graph, *side_effects); LICM* licm = new (arena) LICM(graph, *side_effects); @@ -507,7 +507,7 @@ static void RunOptimizations(HGraph* graph, InstructionSimplifier* simplify4 = new (arena) InstructionSimplifier( graph, stats, "instruction_simplifier_before_codegen"); - IntrinsicsRecognizer* intrinsics = new (arena) IntrinsicsRecognizer(graph, driver); + IntrinsicsRecognizer* intrinsics = new (arena) IntrinsicsRecognizer(graph, driver, stats); HOptimization* optimizations1[] = { intrinsics, diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h index 6375cf1a56..21af170419 100644 --- a/compiler/optimizing/optimizing_compiler_stats.h +++ b/compiler/optimizing/optimizing_compiler_stats.h @@ -54,6 +54,10 @@ enum MethodCompilationStat { kRemovedCheckedCast, kRemovedDeadInstruction, kRemovedNullCheck, + kConstantFolding, + kBooleanSimplifier, + kIntrinsicsRecognizer, + kLICM, kLastStat }; @@ -121,6 +125,10 @@ class OptimizingCompilerStats { case kRemovedCheckedCast: return "kRemovedCheckedCast"; case kRemovedDeadInstruction: return "kRemovedDeadInstruction"; case kRemovedNullCheck: return "kRemovedNullCheck"; + case kConstantFolding: return "kConstantFolding"; + case kBooleanSimplifier: return "kBooleanSimplifier"; + case kIntrinsicsRecognizer: return "kIntrinsicsRecognizer"; + case kLICM: return "kLICM"; case kLastStat: break; // Invalid to print out. } |