summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler/optimizing/live_ranges_test.cc10
-rw-r--r--compiler/optimizing/ssa_test.cc36
2 files changed, 25 insertions, 21 deletions
diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc
index 89c9495..e3c6fec 100644
--- a/compiler/optimizing/live_ranges_test.cc
+++ b/compiler/optimizing/live_ranges_test.cc
@@ -386,7 +386,7 @@ TEST(LiveRangesTest, CFG4) {
Instruction::ADD_INT, 1 << 8,
Instruction::GOTO | 0x300,
Instruction::ADD_INT, 1 << 8,
- Instruction::RETURN | 1 << 8);
+ Instruction::RETURN);
ArenaPool pool;
ArenaAllocator allocator(&pool);
@@ -410,7 +410,10 @@ TEST(LiveRangesTest, CFG4) {
interval = liveness.GetInstructionFromSsaIndex(1)->GetLiveInterval();
range = interval->GetFirstRange();
ASSERT_EQ(4u, range->GetStart());
- ASSERT_EQ(28u, range->GetEnd());
+ ASSERT_EQ(17u, range->GetEnd());
+ range = range->GetNext();
+ ASSERT_EQ(20u, range->GetStart());
+ ASSERT_EQ(23u, range->GetEnd());
ASSERT_TRUE(range->GetNext() == nullptr);
// Test for the first add.
@@ -429,9 +432,8 @@ TEST(LiveRangesTest, CFG4) {
ASSERT_EQ(26u, range->GetEnd());
ASSERT_TRUE(range->GetNext() == nullptr);
- // Test for the phi, which is unused.
HPhi* phi = liveness.GetInstructionFromSsaIndex(4)->AsPhi();
- ASSERT_EQ(phi->NumberOfUses(), 0u);
+ ASSERT_EQ(phi->NumberOfUses(), 1u);
interval = phi->GetLiveInterval();
range = interval->GetFirstRange();
ASSERT_EQ(26u, range->GetStart());
diff --git a/compiler/optimizing/ssa_test.cc b/compiler/optimizing/ssa_test.cc
index fffe5c2..6174dd4 100644
--- a/compiler/optimizing/ssa_test.cc
+++ b/compiler/optimizing/ssa_test.cc
@@ -199,29 +199,31 @@ TEST(SsaTest, Loop1) {
// Test that we create a phi for an initialized local at entry of a loop.
const char* expected =
"BasicBlock 0, succ: 1\n"
- " 0: IntConstant 0 [6, 4, 2, 2]\n"
- " 1: Goto\n"
- "BasicBlock 1, pred: 0, succ: 5, 6\n"
- " 2: Equal(0, 0) [3]\n"
- " 3: If(2)\n"
- "BasicBlock 2, pred: 3, 6, succ: 3\n"
- " 4: Phi(6, 0) [6]\n"
+ " 0: IntConstant 0 [6, 3, 3]\n"
+ " 1: IntConstant 4 [6]\n"
+ " 2: Goto\n"
+ "BasicBlock 1, pred: 0, succ: 4, 2\n"
+ " 3: Equal(0, 0) [4]\n"
+ " 4: If(3)\n"
+ "BasicBlock 2, pred: 1, succ: 3\n"
" 5: Goto\n"
- "BasicBlock 3, pred: 5, 2, succ: 2\n"
- " 6: Phi(0, 4) [4]\n"
+ "BasicBlock 3, pred: 2, 4, succ: 5\n"
+ " 6: Phi(1, 0) [9]\n"
" 7: Goto\n"
- "BasicBlock 4\n"
- // Synthesized blocks to avoid critical edge.
- "BasicBlock 5, pred: 1, succ: 3\n"
+ "BasicBlock 4, pred: 1, succ: 3\n"
" 8: Goto\n"
- "BasicBlock 6, pred: 1, succ: 2\n"
- " 9: Goto\n";
+ "BasicBlock 5, pred: 3, succ: 6\n"
+ " 9: Return(6)\n"
+ "BasicBlock 6, pred: 5\n"
+ " 10: Exit\n";
const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
Instruction::CONST_4 | 0 | 0,
- Instruction::IF_EQ, 3,
- Instruction::GOTO | 0x100,
- Instruction::GOTO | 0xFF00);
+ Instruction::IF_EQ, 4,
+ Instruction::CONST_4 | 4 << 12 | 0,
+ Instruction::GOTO | 0x200,
+ Instruction::GOTO | 0xFF00,
+ Instruction::RETURN | 0 << 8);
TestCode(data, expected);
}