summaryrefslogtreecommitdiff
path: root/compiler/optimizing/scheduler_arm.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2023-04-25 16:40:06 +0000
committer Vladimir Marko <vmarko@google.com> 2023-04-27 10:53:55 +0000
commitcde6497d286337de2ed21c71c85157e2745b742b (patch)
tree087d790efb6987f5aab1da7cd91b89bedcdc5725 /compiler/optimizing/scheduler_arm.cc
parent79dc217688a774fc532584f6551a0aec8b45bc4a (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/scheduler_arm.cc')
-rw-r--r--compiler/optimizing/scheduler_arm.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/optimizing/scheduler_arm.cc b/compiler/optimizing/scheduler_arm.cc
index cded09ac67..3f931c4c49 100644
--- a/compiler/optimizing/scheduler_arm.cc
+++ b/compiler/optimizing/scheduler_arm.cc
@@ -109,8 +109,7 @@ void SchedulingLatencyVisitorARM::VisitRor(HRor* instr) {
// HandleLongRotate
HInstruction* rhs = instr->GetRight();
if (rhs->IsConstant()) {
- // TODO: Remove "OrNull".
- uint64_t rot = Uint64ConstantFrom(rhs->AsConstantOrNull()) & kMaxLongShiftDistance;
+ uint64_t rot = Uint64ConstantFrom(rhs->AsConstant()) & kMaxLongShiftDistance;
if (rot != 0u) {
last_visited_internal_latency_ = 3 * kArmIntegerOpLatency;
last_visited_latency_ = kArmIntegerOpLatency;
@@ -144,8 +143,7 @@ void SchedulingLatencyVisitorARM::HandleShiftLatencies(HBinaryOperation* instr)
if (!rhs->IsConstant()) {
last_visited_internal_latency_ = 8 * kArmIntegerOpLatency;
} else {
- // TODO: Remove "OrNull".
- uint32_t shift_value = Int32ConstantFrom(rhs->AsConstantOrNull()) & kMaxLongShiftDistance;
+ uint32_t shift_value = Int32ConstantFrom(rhs->AsConstant()) & kMaxLongShiftDistance;
if (shift_value == 1 || shift_value >= 32) {
last_visited_internal_latency_ = kArmIntegerOpLatency;
} else {
@@ -835,8 +833,7 @@ void SchedulingLatencyVisitorARM::VisitDiv(HDiv* instruction) {
case DataType::Type::kInt32: {
HInstruction* rhs = instruction->GetRight();
if (rhs->IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t imm = Int32ConstantFrom(rhs->AsConstantOrNull());
+ int32_t imm = Int32ConstantFrom(rhs->AsConstant());
HandleDivRemConstantIntegralLatencies(imm);
} else {
last_visited_latency_ = kArmDivIntegerLatency;
@@ -904,8 +901,7 @@ void SchedulingLatencyVisitorARM::VisitRem(HRem* instruction) {
case DataType::Type::kInt32: {
HInstruction* rhs = instruction->GetRight();
if (rhs->IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t imm = Int32ConstantFrom(rhs->AsConstantOrNull());
+ int32_t imm = Int32ConstantFrom(rhs->AsConstant());
HandleDivRemConstantIntegralLatencies(imm);
} else {
last_visited_internal_latency_ = kArmDivIntegerLatency;