Fix PR2088. Use modulo linear equation solver to compute loop iteration