From 91699b64c66b5e69995f4e84399f8da640a3fe49 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Wed, 13 Jan 2021 14:18:41 +0100 Subject: [PATCH] Less useless logging --- .../mos/opt/RepeatedIndexCalculationOptimization.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/scala/millfork/assembly/mos/opt/RepeatedIndexCalculationOptimization.scala b/src/main/scala/millfork/assembly/mos/opt/RepeatedIndexCalculationOptimization.scala index 6abf41e8..8d8199ee 100644 --- a/src/main/scala/millfork/assembly/mos/opt/RepeatedIndexCalculationOptimization.scala +++ b/src/main/scala/millfork/assembly/mos/opt/RepeatedIndexCalculationOptimization.scala @@ -21,6 +21,10 @@ case class RepeatedIndexCalculationOptimization(forX: Boolean) extends AssemblyO override def optimize(f: NormalFunction, code: List[AssemblyLine], context: OptimizationContext): List[AssemblyLine] = { val log = context.log val allRuns = findAllRuns(code, 0, None).result + if (allRuns.size <= 1) { + log.trace("No index calculations found") + return code + } if (log.traceEnabled) { log.trace("All index calculations found: " + allRuns) for ((line, ix) <- code.zipWithIndex) { @@ -32,7 +36,6 @@ case class RepeatedIndexCalculationOptimization(forX: Boolean) extends AssemblyO } } } - if (allRuns.size <= 1) return code lazy val reverseFlow = ReverseFlowAnalyzer.analyze(code, context.niceFunctionProperties) val flow = CoarseFlowAnalyzer.analyze(f, code, context) var replacements: Map[Int, Int] = Map()