  We discuss the deconfinement and the CP-breaking phase transitions at
$\theta=\pi$ in Yang-Mills theories. The 't Hooft anomaly matching prohibits
the confined phase with CP symmetry and requires $T_{dec}(\theta=\pi) \le
T_{CP}$, where $T_{dec}(\theta=\pi)$ and $T_{CP}$ denote the deconfinement and
the CP-restoration temperatures, respectively, at $\theta=\pi$. We analytically
study these two phase transitions in softly-broken $\mathcal{N}=1$
supersymmetric Yang-Mills theories on small $\mathbb{R}^3\times S^1$ with the
periodic boundary condition for gluinos. For most gauge groups except SU(2) in
this model, we find that the inequality is saturated, so deconfinement and CP
restoration occur simultaneously. We demonstrate special features of the SU(2)
gauge theory: There is a finite window of two temperatures,
$T_{dec}(\pi)<T_{CP}$, which indicates the existence of a novel CP-broken
deconfined phase. We also discuss an implication of the novel phase for domain
walls and their junctions.
