diff --git a/teavm-core/src/main/java/org/teavm/optimization/LoopInvariantMotion.java b/teavm-core/src/main/java/org/teavm/optimization/LoopInvariantMotion.java index 786c16897..64e6c26df 100644 --- a/teavm-core/src/main/java/org/teavm/optimization/LoopInvariantMotion.java +++ b/teavm-core/src/main/java/org/teavm/optimization/LoopInvariantMotion.java @@ -46,6 +46,9 @@ public class LoopInvariantMotion implements MethodOptimization { IntegerStack stack = new IntegerStack(graph.size()); int[] defLocation = new int[program.variableCount()]; Arrays.fill(defLocation, -1); + for (int i = 0; i <= method.parameterCount(); ++i) { + defLocation[i] = 0; + } for (int i = 0; i < domGraph.size(); ++i) { if (dom.immediateDominatorOf(i) < 0) { stack.push(i);