When the spring is compressed its potential energy will increase.
Explanation:
When you a compress or stretch a spring that you work against the restoring work of the spring the potential energy of the spring increases.
This work is stored as the elastic potential energy of the spring. The potential energy increases with displacement from the equilibrium position of the spring
So, when the compression is doubled its potential energy increases double the time along with displacement.