summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2015-04-16 09:49:55 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-04-16 09:49:56 +0000
commitda93333d568f3c5bd8eeb58341d10a332e1d42bf (patch)
treece6aba4bb0214f733707c58634fa98e73a03563b /compiler/optimizing/nodes.cc
parent669d8a1edbb2a78e08731a9cd6d8e815b0ec49db (diff)
parent4a3faecbe4157225a3fe83a9ef7f4992dfc9c19d (diff)
Merge "ART: Don't duplicate null/int/long constants when inlining"
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 ada3487963..53ee711920 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -969,7 +969,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++));