diff options
author | 2023-04-25 16:40:06 +0000 | |
---|---|---|
committer | 2023-04-27 10:53:55 +0000 | |
commit | cde6497d286337de2ed21c71c85157e2745b742b (patch) | |
tree | 087d790efb6987f5aab1da7cd91b89bedcdc5725 /compiler/optimizing/live_ranges_test.cc | |
parent | 79dc217688a774fc532584f6551a0aec8b45bc4a (diff) |
Optimizing: Add `HInstruction::As##type()`.
After the old implementation was renamed in
https://android-review.googlesource.com/2526708 ,
we introduce a new function with the old name but new
behavior, just `DCHECK()`-ing the instruction kind before
casting down the pointer. We change appropriate calls from
`As##type##OrNull()` to `As##type()` to avoid unncessary
run-time checks and reduce the size of libart-compiler.so.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: run-gtests.sh
Test: testrunner.py --target --optimizing
Bug: 181943478
Change-Id: I025681612a77ca2157fed4886ca47f2053975d4e
Diffstat (limited to 'compiler/optimizing/live_ranges_test.cc')
-rw-r--r-- | compiler/optimizing/live_ranges_test.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc index 4e1a49b41b..fb1a23eef4 100644 --- a/compiler/optimizing/live_ranges_test.cc +++ b/compiler/optimizing/live_ranges_test.cc @@ -311,8 +311,7 @@ TEST_F(LiveRangesTest, Loop2) { liveness.Analyze(); // Test for the 0 constant. - // TODO: Remove "OrNull". - HIntConstant* constant = liveness.GetInstructionFromSsaIndex(0)->AsIntConstantOrNull(); + HIntConstant* constant = liveness.GetInstructionFromSsaIndex(0)->AsIntConstant(); LiveInterval* interval = constant->GetLiveInterval(); LiveRange* range = interval->GetFirstRange(); ASSERT_EQ(2u, range->GetStart()); @@ -322,8 +321,7 @@ TEST_F(LiveRangesTest, Loop2) { ASSERT_TRUE(range->GetNext() == nullptr); // Test for the loop phi. - // TODO: Remove "OrNull". - HPhi* phi = liveness.GetInstructionFromSsaIndex(1)->AsPhiOrNull(); + HPhi* phi = liveness.GetInstructionFromSsaIndex(1)->AsPhi(); interval = phi->GetLiveInterval(); range = interval->GetFirstRange(); ASSERT_EQ(10u, range->GetStart()); @@ -334,8 +332,7 @@ TEST_F(LiveRangesTest, Loop2) { ASSERT_EQ(24u, range->GetEnd()); // Test for the add instruction. - // TODO: Remove "OrNull". - HAdd* add = liveness.GetInstructionFromSsaIndex(2)->AsAddOrNull(); + HAdd* add = liveness.GetInstructionFromSsaIndex(2)->AsAdd(); interval = add->GetLiveInterval(); range = interval->GetFirstRange(); ASSERT_EQ(18u, range->GetStart()); @@ -409,8 +406,7 @@ TEST_F(LiveRangesTest, CFG4) { ASSERT_TRUE(range->GetNext() == nullptr); // Test for the first add. - // TODO: Remove "OrNull". - HAdd* add = liveness.GetInstructionFromSsaIndex(2)->AsAddOrNull(); + HAdd* add = liveness.GetInstructionFromSsaIndex(2)->AsAdd(); interval = add->GetLiveInterval(); range = interval->GetFirstRange(); ASSERT_EQ(16u, range->GetStart()); @@ -418,16 +414,14 @@ TEST_F(LiveRangesTest, CFG4) { ASSERT_TRUE(range->GetNext() == nullptr); // Test for the second add. - // TODO: Remove "OrNull". - add = liveness.GetInstructionFromSsaIndex(3)->AsAddOrNull(); + add = liveness.GetInstructionFromSsaIndex(3)->AsAdd(); interval = add->GetLiveInterval(); range = interval->GetFirstRange(); ASSERT_EQ(22u, range->GetStart()); ASSERT_EQ(26u, range->GetEnd()); ASSERT_TRUE(range->GetNext() == nullptr); - // TODO: Remove "OrNull". - HPhi* phi = liveness.GetInstructionFromSsaIndex(4)->AsPhiOrNull(); + HPhi* phi = liveness.GetInstructionFromSsaIndex(4)->AsPhi(); ASSERT_TRUE(phi->GetUses().HasExactlyOneElement()); interval = phi->GetLiveInterval(); range = interval->GetFirstRange(); |