Skip to content

Commit

Permalink
Merge pull request #9065 from lrytz/bigDce
Browse files Browse the repository at this point in the history
Run DCE also on large methods
  • Loading branch information
retronym committed Jun 18, 2020
2 parents d84b7de + b9c828e commit a072205
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -364,20 +364,18 @@ abstract class LocalOpt {
(codeChanged, requireEliminateUnusedLocals)
}

val (nullnessDceBoxesCastsCopypropPushpopOrJumpsChanged, requireEliminateUnusedLocals) = if (AsmAnalyzer.sizeOKForBasicValue(method)) {
// we run DCE even if the method is already in the `unreachableCodeEliminated` map: the DCE
// here is more thorough than `minimalRemoveUnreachableCode` that run before inlining.
val r = removalRound(
requestNullness = true,
requestDCE = true,
requestBoxUnbox = true,
requestStaleStores = true,
requestPushPop = true,
requestStoreLoad = true,
firstIteration = true)
if (compilerSettings.optUnreachableCode) BackendUtils.setDceDone(method)
r
} else (false, false)
// we run DCE even if the method is already in the `unreachableCodeEliminated` map: the DCE
// here is more thorough than `minimalRemoveUnreachableCode` that run before inlining.
val (nullnessDceBoxesCastsCopypropPushpopOrJumpsChanged, requireEliminateUnusedLocals) = removalRound(
requestNullness = true,
requestDCE = true,
requestBoxUnbox = true,
requestStaleStores = true,
requestPushPop = true,
requestStoreLoad = true,
firstIteration = true)

if (compilerSettings.optUnreachableCode) BackendUtils.setDceDone(method)

// (*) Removing stale local variable descriptors is required for correctness, see comment in `methodOptimizations`
val localsRemoved =
Expand Down

0 comments on commit a072205

Please sign in to comment.