Dimensional reduction and the phase diagram of 5d Yang-Mills theory