  We propose a method for performing software pipelining on quantum for-loop
programs, exploiting parallelism in and across iterations. We redefine concepts
that are useful in program optimization, including array aliasing, instruction
dependency and resource conflict, this time in optimization of quantum
programs. Using the redefined concepts, we present a software pipelining
algorithm exploiting instruction-level parallelism in quantum loop programs.
The optimization method is then evaluated on some test cases, including popular
applications like QAOA, and compared with several baseline results. The
evaluation results show that our approach outperforms loop optimizers
exploiting only in-loop optimization chances by reducing total depth of the
loop program to close to the optimal program depth obtained by full loop
unrolling, while generating much smaller code in size. This is the first step
towards optimization of a quantum program with such loop control flow as far as
we know.
