diff options
| author | Mingyao Yang <mingyao@google.com> | 2017-11-30 14:45:44 -0800 |
|---|---|---|
| committer | Mingyao Yang <mingyao@google.com> | 2017-11-30 14:45:44 -0800 |
| commit | 75bb2f3c85330b2aeba9e0a4a25f7eb059bcd754 (patch) | |
| tree | 2e9c2884dc546540c66b057374822a45f7d9a414 /compiler/optimizing/nodes.cc | |
| parent | 1f541bf57dfdfe4faf169b811aadb91298a886ca (diff) | |
| download | art-75bb2f3c85330b2aeba9e0a4a25f7eb059bcd754.tar.gz art-75bb2f3c85330b2aeba9e0a4a25f7eb059bcd754.tar.bz2 art-75bb2f3c85330b2aeba9e0a4a25f7eb059bcd754.zip | |
Type conversion elimination of constants
A better way of eliminating type conversion for constants.
Test: run-test on host. 711-checker-type-conversion.
Change-Id: I457bc091542a5ac4cc4e77cadb012ee7cb040ce8
Diffstat (limited to 'compiler/optimizing/nodes.cc')
| -rw-r--r-- | compiler/optimizing/nodes.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index fa580d9bed..4a9da7ece1 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1403,6 +1403,14 @@ HConstant* HTypeConversion::TryStaticEvaluation() const { if (GetInput()->IsIntConstant()) { int32_t value = GetInput()->AsIntConstant()->GetValue(); switch (GetResultType()) { + case DataType::Type::kInt8: + return graph->GetIntConstant(static_cast<int8_t>(value), GetDexPc()); + case DataType::Type::kUint8: + return graph->GetIntConstant(static_cast<uint8_t>(value), GetDexPc()); + case DataType::Type::kInt16: + return graph->GetIntConstant(static_cast<int16_t>(value), GetDexPc()); + case DataType::Type::kUint16: + return graph->GetIntConstant(static_cast<uint16_t>(value), GetDexPc()); case DataType::Type::kInt64: return graph->GetLongConstant(static_cast<int64_t>(value), GetDexPc()); case DataType::Type::kFloat32: @@ -1415,6 +1423,14 @@ HConstant* HTypeConversion::TryStaticEvaluation() const { } else if (GetInput()->IsLongConstant()) { int64_t value = GetInput()->AsLongConstant()->GetValue(); switch (GetResultType()) { + case DataType::Type::kInt8: + return graph->GetIntConstant(static_cast<int8_t>(value), GetDexPc()); + case DataType::Type::kUint8: + return graph->GetIntConstant(static_cast<uint8_t>(value), GetDexPc()); + case DataType::Type::kInt16: + return graph->GetIntConstant(static_cast<int16_t>(value), GetDexPc()); + case DataType::Type::kUint16: + return graph->GetIntConstant(static_cast<uint16_t>(value), GetDexPc()); case DataType::Type::kInt32: return graph->GetIntConstant(static_cast<int32_t>(value), GetDexPc()); case DataType::Type::kFloat32: |
