  Analyzing the pion-mass dependence of $\pi\pi$ scattering phase shifts beyond
the low-energy region requires the unitarization of the amplitudes from chiral
perturbation theory. In the two-flavor theory, unitarization via the
inverse-amplitude method (IAM) can be justified from dispersion relations,
which is therefore expected to provide reliable predictions for the pion-mass
dependence of results from lattice QCD calculations. In this work, we provide
compact analytic expression for the two-loop partial-wave amplitudes for
$J=0,1,2$ required for the IAM at subleading order. To analyze the pion-mass
dependence of recent lattice QCD results for the $P$-wave, we develop a fit
strategy that for the first time allows us to perform stable two-loop IAM fits
and assess the chiral convergence of the IAM approach. While the comparison of
subsequent orders suggests a breakdown scale not much below the $\rho$ mass, a
detailed understanding of the systematic uncertainties of lattice QCD data is
critical to obtain acceptable fits, especially at larger pion masses.
