summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/nodes.h1
-rw-r--r--compiler/optimizing/optimizing_compiler.cc5
-rw-r--r--compiler/optimizing/optimizing_compiler_stats.h1
-rw-r--r--compiler/optimizing/ssa_builder.cc20
4 files changed, 27 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 25f9e3cb73..09ae6fab84 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -131,6 +131,7 @@ enum GraphAnalysisResult {
kAnalysisFailThrowCatchLoop,
kAnalysisFailAmbiguousArrayOp,
kAnalysisFailIrreducibleLoopAndStringInit,
+ kAnalysisFailPhiEquivalentInOsr,
kAnalysisSuccess,
};
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 6f3b9feb9d..b1a3abee2f 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -914,6 +914,11 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator,
MethodCompilationStat::kNotCompiledIrreducibleLoopAndStringInit);
break;
}
+ case kAnalysisFailPhiEquivalentInOsr: {
+ MaybeRecordStat(compilation_stats_.get(),
+ MethodCompilationStat::kNotCompiledPhiEquivalentInOsr);
+ break;
+ }
case kAnalysisSuccess:
UNREACHABLE();
}
diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h
index ddd57f5f1a..83dbef7409 100644
--- a/compiler/optimizing/optimizing_compiler_stats.h
+++ b/compiler/optimizing/optimizing_compiler_stats.h
@@ -61,6 +61,7 @@ enum class MethodCompilationStat {
kNotCompiledVerificationError,
kNotCompiledVerifyAtRuntime,
kNotCompiledIrreducibleLoopAndStringInit,
+ kNotCompiledPhiEquivalentInOsr,
kInlinedMonomorphicCall,
kInlinedPolymorphicCall,
kMonomorphicCall,
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc
index 0d0e1ecf1f..a5e8ff65a9 100644
--- a/compiler/optimizing/ssa_builder.cc
+++ b/compiler/optimizing/ssa_builder.cc
@@ -496,6 +496,22 @@ void SsaBuilder::RemoveRedundantUninitializedStrings() {
}
}
+static bool HasPhiEquivalentAtLoopEntry(HGraph* graph) {
+ // Phi equivalents for a dex register do not work with OSR, as the phis will
+ // receive two different stack slots but only one is recorded in the stack
+ // map.
+ for (HBasicBlock* block : graph->GetReversePostOrder()) {
+ if (block->IsLoopHeader()) {
+ for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
+ if (it.Current()->AsPhi()->HasEquivalentPhi()) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
GraphAnalysisResult SsaBuilder::BuildSsa() {
DCHECK(!graph_->IsInSsaForm());
@@ -574,6 +590,10 @@ GraphAnalysisResult SsaBuilder::BuildSsa() {
// other optimizations.
RemoveRedundantUninitializedStrings();
+ if (graph_->IsCompilingOsr() && HasPhiEquivalentAtLoopEntry(graph_)) {
+ return kAnalysisFailPhiEquivalentInOsr;
+ }
+
graph_->SetInSsaForm();
return kAnalysisSuccess;
}