diff options
author | Evgeny Astigeevich <evgeny.astigeevich@linaro.org> | 2020-06-12 10:51:43 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2020-06-17 08:00:58 +0000 |
commit | 6587d9110bd7f836e43db16f3f676da996218aef (patch) | |
tree | 437d06a8e60fd70aaafaf2b167dfe636a303c68a /compiler/optimizing/optimization.cc | |
parent | 1912a5c7b9400009e361b0db52da77cc78f1cd77 (diff) |
ART: Simplify HRem to reuse existing HDiv
A pattern seen in libcore and SPECjvm2008 workloads is a pair of HRem/HDiv
having the same dividend and divisor. The code generator processes
them separately and generates duplicated instructions calculating HDiv.
This CL adds detection of such a pattern to the instruction simplifier.
This optimization affects HInductionVarAnalysis and HLoopOptimization
preventing some loop optimizations. To avoid this the instruction simplifier
has the loop_friendly mode which means not to optimize HRems if they are in a loop.
A microbenchmark run on Pixel 3 shows the following improvements:
| little cores | big cores
arm32 Int32 | +21% | +40%
arm32 Int64 | +46% | +44%
arm64 Int32 | +27% | +14%
arm64 Int64 | +33% | +27%
Test: 411-checker-instruct-simplifier-hrem
Test: test.py --host --optimizing --jit --gtest --interpreter
Test: test.py --target --optimizing --jit --interpreter
Test: run-gtests.sh
Change-Id: I376a1bd299d7fe10acad46771236edd5f85dfe56
Diffstat (limited to 'compiler/optimizing/optimization.cc')
-rw-r--r-- | compiler/optimizing/optimization.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/optimizing/optimization.cc b/compiler/optimizing/optimization.cc index ec3b8c4904..424fbd9f45 100644 --- a/compiler/optimizing/optimization.cc +++ b/compiler/optimizing/optimization.cc @@ -83,6 +83,7 @@ const char* OptimizationPassName(OptimizationPass pass) { return HInliner::kInlinerPassName; case OptimizationPass::kSelectGenerator: return HSelectGenerator::kSelectGeneratorPassName; + case OptimizationPass::kAggressiveInstructionSimplifier: case OptimizationPass::kInstructionSimplifier: return InstructionSimplifier::kInstructionSimplifierPassName; case OptimizationPass::kCHAGuardOptimization: @@ -248,6 +249,13 @@ ArenaVector<HOptimization*> ConstructOptimizations( case OptimizationPass::kInstructionSimplifier: opt = new (allocator) InstructionSimplifier(graph, codegen, stats, pass_name); break; + case OptimizationPass::kAggressiveInstructionSimplifier: + opt = new (allocator) InstructionSimplifier(graph, + codegen, + stats, + pass_name, + /* use_all_optimizations_ = */ true); + break; case OptimizationPass::kCHAGuardOptimization: opt = new (allocator) CHAGuardOptimization(graph, pass_name); break; |