diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/optimizing/dead_code_elimination.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/optimizing/dead_code_elimination.cc b/compiler/optimizing/dead_code_elimination.cc index b31de98e25..17a006cc3a 100644 --- a/compiler/optimizing/dead_code_elimination.cc +++ b/compiler/optimizing/dead_code_elimination.cc @@ -122,7 +122,12 @@ void HDeadCodeElimination::RemoveDeadInstructions() { if (!inst->HasSideEffects() && !inst->CanThrow() && !inst->IsSuspendCheck() - && !inst->IsMemoryBarrier() // If we added an explicit barrier then we should keep it. + // The current method needs to stay in the graph in case of inlining. + // It is always passed anyway, and keeping it in the graph does not + // affect the generated code. + && !inst->IsCurrentMethod() + // If we added an explicit barrier then we should keep it. + && !inst->IsMemoryBarrier() && !inst->HasUses()) { block->RemoveInstruction(inst); MaybeRecordStat(MethodCompilationStat::kRemovedDeadInstruction); |