From a04e7b7ceae01a7ceda41419e4c639a43e18361e Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 18 Jun 2015 15:46:47 +0100 Subject: Run a simplification pass before code generation. The code generators assume things that only the instruction simplier ensures. So it has to be run last in case previous optimiziations broke those assumptions. bug:21865464 (cherry picked from commit b2bdfce7f805b00668a2521b1c939a0aafb2be49) Change-Id: Ibf4384a911e400eb7586bbf6b4edd6351034cbd8 --- compiler/optimizing/optimizing_compiler.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 64d6023..810b4f8 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -337,6 +337,7 @@ static void RunOptimizations(HGraph* graph, BoundsCheckElimination bce(graph); ReferenceTypePropagation type_propagation(graph, dex_file, dex_compilation_unit, handles); InstructionSimplifier simplify2(graph, stats, "instruction_simplifier_after_types"); + InstructionSimplifier simplify3(graph, stats, "instruction_simplifier_before_codegen"); IntrinsicsRecognizer intrinsics(graph, dex_compilation_unit.GetDexFile(), driver); @@ -357,6 +358,10 @@ static void RunOptimizations(HGraph* graph, &type_propagation, &simplify2, &dce2, + // The codegen has a few assumptions that only the instruction simplifier can + // satisfy. For example, the code generator does not expect to see a + // HTypeConversion from a type to the same type. + &simplify3, }; RunOptimizations(optimizations, arraysize(optimizations), pass_info_printer); -- cgit v1.1