  This paper proposes QDFO, a dataflow-based optimization approach to Microsoft
QIR. QDFO consists of two main functions: one is to preprocess the QIR code so
that the LLVM optimizer can capture more optimization opportunities, and the
other is to optimize the QIR code so that duplicate loading and constructing of
qubits and qubit arrays can be avoided. We evaluated our work on the IBM
Challenge Dataset, the results show that our method effectively reduces
redundant operations in the QIR code. We also completed a preliminary
implementation of QDFO and conducted a case study on the real-world code. Our
observational study indicates that the LLVM optimizer can further optimize the
QIR code preprocessed by our algorithm. Both the experiments and the case study
demonstrate the effectiveness of our approach.
