summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/dead_code_elimination_test.cc
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2014-09-30 16:15:14 +0100
committerRoland Levillain <rpl@google.com>2014-10-01 11:52:58 +0100
commitbf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8 (patch)
tree0bd049b173d23fcaed5c1b5cb4299e8faef840da /compiler/optimizing/dead_code_elimination_test.cc
parent34bb808affbed7a1db177b9ef4ab5461c2b2106b (diff)
downloadandroid_art-bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8.tar.gz
android_art-bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8.tar.bz2
android_art-bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8.zip
Introduce a class to implement optimization passes.
- Add art::HOptimization. - Rename art::ConstantPropagation to art::HConstantFolding in compiler/optimizing/constant_folding.h to avoid name clashes with a class of the same name in compiler/dex/post_opt_passes.h. - Rename art::DeadCodeElimination to art::HDeadCodeElimination for consistency reasons. - Have art::HDeadCodeElimination and art::HConstantFolding derive from art::HOptimization. - Start to use these optimizations in art:OptimizingCompiler::TryCompile. Change-Id: Iaab350c122d87b2333b3760312b15c0592d7e010
Diffstat (limited to 'compiler/optimizing/dead_code_elimination_test.cc')
-rw-r--r--compiler/optimizing/dead_code_elimination_test.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/optimizing/dead_code_elimination_test.cc b/compiler/optimizing/dead_code_elimination_test.cc
index 245bcb21d5..25e9555435 100644
--- a/compiler/optimizing/dead_code_elimination_test.cc
+++ b/compiler/optimizing/dead_code_elimination_test.cc
@@ -14,10 +14,11 @@
* limitations under the License.
*/
+#include "code_generator_x86.h"
#include "dead_code_elimination.h"
-#include "pretty_printer.h"
#include "graph_checker.h"
#include "optimizing_unit_test.h"
+#include "pretty_printer.h"
#include "gtest/gtest.h"
@@ -39,16 +40,17 @@ static void TestCode(const uint16_t* data,
std::string actual_before = printer_before.str();
ASSERT_EQ(actual_before, expected_before);
- DeadCodeElimination(graph).Run();
+ x86::CodeGeneratorX86 codegen(graph);
+ HGraphVisualizer visualizer(nullptr, graph, codegen, "");
+ HDeadCodeElimination(graph, visualizer).Run();
+ SSAChecker ssa_checker(&allocator, graph);
+ ssa_checker.VisitInsertionOrder();
+ ASSERT_TRUE(ssa_checker.IsValid());
StringPrettyPrinter printer_after(graph);
printer_after.VisitInsertionOrder();
std::string actual_after = printer_after.str();
ASSERT_EQ(actual_after, expected_after);
-
- SSAChecker ssa_checker(&allocator, graph);
- ssa_checker.VisitInsertionOrder();
- ASSERT_TRUE(ssa_checker.IsValid());
}
@@ -94,6 +96,7 @@ TEST(DeadCodeElimination, AdditionAndConditionalJump) {
"BasicBlock 5, pred: 1, succ: 3\n"
" 21: Goto 3\n";
+ // Expected difference after dead code elimination.
diff_t expected_diff = {
{ " 3: IntConstant [15, 22, 8]\n", " 3: IntConstant [22, 8]\n" },
{ " 22: Phi(3, 5) [15]\n", " 22: Phi(3, 5)\n" },
@@ -164,7 +167,7 @@ TEST(DeadCodeElimination, AdditionsAndInconditionalJumps) {
"BasicBlock 5, pred: 4\n"
" 28: Exit\n";
- // Expected difference after constant propagation.
+ // Expected difference after dead code elimination.
diff_t expected_diff = {
{ " 13: IntConstant [14]\n", removed },
{ " 24: IntConstant [25]\n", removed },