diff options
Diffstat (limited to 'compiler/optimizing/codegen_test.cc')
-rw-r--r-- | compiler/optimizing/codegen_test.cc | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 4f37c37e39..6be79fa75c 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -206,10 +206,13 @@ static void RunCode(CodeGenerator* codegen, std::function<void(HGraph*)> hook_before_codegen, bool has_result, Expected expected) { - ASSERT_TRUE(graph->IsInSsaForm()); - - SSAChecker graph_checker(graph); + GraphChecker graph_checker(graph); graph_checker.Run(); + if (!graph_checker.IsValid()) { + for (auto error : graph_checker.GetErrors()) { + std::cout << error << std::endl; + } + } ASSERT_TRUE(graph_checker.IsValid()); SsaLivenessAnalysis liveness(graph, codegen); @@ -292,14 +295,9 @@ static void TestCode(const uint16_t* data, for (InstructionSet target_isa : GetTargetISAs()) { ArenaPool pool; ArenaAllocator arena(&pool); - HGraph* graph = CreateGraph(&arena); - HGraphBuilder builder(graph); - const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data); - bool graph_built = builder.BuildGraph(*item); - ASSERT_TRUE(graph_built); + HGraph* graph = CreateCFG(&arena, data); // Remove suspend checks, they cannot be executed in this context. RemoveSuspendChecks(graph); - TransformToSsa(graph); RunCode(target_isa, graph, [](HGraph*) {}, has_result, expected); } } @@ -310,14 +308,9 @@ static void TestCodeLong(const uint16_t* data, for (InstructionSet target_isa : GetTargetISAs()) { ArenaPool pool; ArenaAllocator arena(&pool); - HGraph* graph = CreateGraph(&arena); - HGraphBuilder builder(graph, Primitive::kPrimLong); - const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data); - bool graph_built = builder.BuildGraph(*item); - ASSERT_TRUE(graph_built); + HGraph* graph = CreateCFG(&arena, data, Primitive::kPrimLong); // Remove suspend checks, they cannot be executed in this context. RemoveSuspendChecks(graph); - TransformToSsa(graph); RunCode(target_isa, graph, [](HGraph*) {}, has_result, expected); } } @@ -640,6 +633,7 @@ TEST_F(CodegenTest, NonMaterializedCondition) { ArenaAllocator allocator(&pool); HGraph* graph = CreateGraph(&allocator); + HBasicBlock* entry = new (&allocator) HBasicBlock(graph); graph->AddBlock(entry); graph->SetEntryBlock(entry); @@ -672,7 +666,7 @@ TEST_F(CodegenTest, NonMaterializedCondition) { else_block->AddInstruction(new (&allocator) HReturn(constant1)); ASSERT_FALSE(equal->IsEmittedAtUseSite()); - TransformToSsa(graph); + graph->BuildDominatorTree(); PrepareForRegisterAllocation(graph).Run(); ASSERT_TRUE(equal->IsEmittedAtUseSite()); @@ -723,7 +717,7 @@ TEST_F(CodegenTest, MaterializedCondition1) { HReturn ret(&cmp_lt); code_block->AddInstruction(&ret); - TransformToSsa(graph); + graph->BuildDominatorTree(); auto hook_before_codegen = [](HGraph* graph_in) { HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors()[0]; HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); @@ -791,7 +785,7 @@ TEST_F(CodegenTest, MaterializedCondition2) { HReturn ret_ge(cst_ge); if_false_block->AddInstruction(&ret_ge); - TransformToSsa(graph); + graph->BuildDominatorTree(); auto hook_before_codegen = [](HGraph* graph_in) { HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors()[0]; HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); @@ -907,7 +901,7 @@ static void TestComparison(IfCondition condition, block->AddInstruction(comparison); block->AddInstruction(new (&allocator) HReturn(comparison)); - TransformToSsa(graph); + graph->BuildDominatorTree(); RunCode(target_isa, graph, [](HGraph*) {}, true, expected_result); } |