Efficient Bayesian analysis of multiple changepoint models with dependence across segments