summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2015-04-16 10:38:44 +0100
committer David Brazdil <dbrazdil@google.com> 2015-04-16 10:40:53 +0100
commit4a3faecbe4157225a3fe83a9ef7f4992dfc9c19d (patch)
tree90cd60a8f7e39f6d160c3e24598fc898cdac3d7e /compiler/optimizing/nodes.cc
parent8e8bb8aab6f19ccb5b5869a632d9bc882891e17e (diff)
ART: Don't duplicate null/int/long constants when inlining
Change-Id: I7e6a3393fcbbcf76b4ba2000915ba6bbbfb7c70e
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index d8a8554610..c1e2351b93 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -971,7 +971,14 @@ void HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) {
int parameter_index = 0;
for (HInstructionIterator it(entry_block_->GetInstructions()); !it.Done(); it.Advance()) {
HInstruction* current = it.Current();
- if (current->IsConstant()) {
+ if (current->IsNullConstant()) {
+ current->ReplaceWith(outer_graph->GetNullConstant());
+ } else if (current->IsIntConstant()) {
+ current->ReplaceWith(outer_graph->GetIntConstant(current->AsIntConstant()->GetValue()));
+ } else if (current->IsLongConstant()) {
+ current->ReplaceWith(outer_graph->GetLongConstant(current->AsLongConstant()->GetValue()));
+ } else if (current->IsFloatConstant() || current->IsDoubleConstant()) {
+ // TODO: Don't duplicate floating-point constants.
current->MoveBefore(outer_graph->GetEntryBlock()->GetLastInstruction());
} else if (current->IsParameterValue()) {
current->ReplaceWith(invoke->InputAt(parameter_index++));