  The recently inferred variations in the stellar initial mass function (IMF)
among local high-mass early-type galaxies may require a reinterpretation of
observations of galaxy populations and may have important consequences for the
predictions of models of galaxy formation and evolution. We present a new pair
of cosmological, hydrodynamical simulations based on the EAGLE model that
self-consistently adopt an IMF that respectively becomes bottom- or top-heavy
in high-pressure environments for individual star-forming gas particles. In
such models, the excess stellar mass-to-light ($M/L$) ratio with respect to a
reference IMF is increased due to an overabundance of low-mass dwarf stars or
stellar remnants, respectively. Crucially, both pressure-dependent IMFs have
been calibrated to reproduce the observed trends of increasing excess $M/L$
with central stellar velocity dispersion ($\sigma_e$) in early-type galaxies,
while maintaining agreement with the observables used to calibrate the EAGLE
model, namely the galaxy luminosity function, half-light radii of late-type
galaxies, and black hole masses. We find that while the $M/L$ excess is a good
measure of the IMF for low-mass slope variations, it depends strongly on the
age of the stellar population for high-mass slope variations. The normalization
of the [Mg/Fe]$-\sigma_e$ relation is decreased (increased) for bottom-
(top-)heavy IMF variations, while the slope is not strongly affected.
Bottom-heavy variations have little impact on galaxy metallicities, half-light
radii of early-type galaxies, or star formation rates, while top-heavy
variations significantly increase these quantities for high-mass galaxies,
leading to tension with observations.
