diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2018-05-17 08:14:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-17 08:14:11 +0000 |
commit | cb2187c626828f5cefc0082a4df392ed7e1214e3 (patch) | |
tree | 9325c92f0520f3ecc8652335ff545d6ab800da8e /compiler/optimizing/instruction_builder.cc | |
parent | bb071ee44ddc1751c79d2a8c31afe4ea3d72b5f4 (diff) | |
parent | d147e2fb824a92acb9cd86bd92d3f1c137d488c5 (diff) |
Merge "Don't compile methods with irreducible loops and String.<init>."
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 0e20a65a2d..42031f9e25 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -1360,9 +1360,15 @@ bool HInstructionBuilder::HandleStringInit(HInvoke* invoke, if (arg_this->IsNewInstance()) { ssa_builder_->AddUninitializedString(arg_this->AsNewInstance()); } else { + // The only reason a HPhi can flow in a String.<init> is when there is an + // irreducible loop, which will create HPhi for all dex registers at loop entry. DCHECK(arg_this->IsPhi()); - // NewInstance is not the direct input of the StringFactory call. It might - // be redundant but optimizing this case is not worth the effort. + DCHECK(graph_->HasIrreducibleLoops()); + // Don't bother compiling a method in that situation. While we could look at all + // phis related to the HNewInstance, it's not worth the trouble. + MaybeRecordStat(compilation_stats_, + MethodCompilationStat::kNotCompiledIrreducibleAndStringInit); + return false; } // Walk over all vregs and replace any occurrence of `arg_this` with `invoke`. |