Current quantum processors are noisy and have limited coherence and imperfect gate implementations. On such hardware, only algorithms that are shorter than the overall coherence time can be implemented and executed successfully. A good quantum compiler must translate an input program into the most efficient equivalent of itself, getting the most out of the available hardware. In this work, we present novel deterministic algorithms for compiling recurrent quantum circuit patterns in polynomial time. In particular, such patterns appear in quantum circuits that are used to compute the ground-state properties of molecular systems using the variational quantum eigensolver method together with the RyRz heuristic wavefunction Ansätz. We show that our pattern-oriented compiling algorithms, combined with an efficient swapping strategy, produces—in general—output programs that are comparable to those obtained with state-of-the-art compilers, in terms of CNOT count and CNOT depth. In particular, our solution produces unmatched results on RyRz circuits.