In my simple mind, debt is something to be avoided except when you have no choice... like when you're 25, with no savings, and need reliable transportation to get to/from your job. It's not intended to boost your investable assets in retirement. That type of balance sheet leverage, and the unnecessary risk and uncertainty it creates, has no place in my retirement plan. I'm not a "sleep better" type. IMHO, it's just an inappropriate "capital structure" for that stage of life. Even worse if you're counting on the market outperforming your mortgage to enable early retirement.
Now... having said that, if you find yourself going into retirement holding a 20-30 year mortgage at sub-3.5%, it's hard to imagine a financial/market scenario that won't favor holding the mortgage. As someone else posted, under that worst-case scenario, the mortgage would be the least of your concerns. OTOH, if I was sub-15 years with a 4-5% rate or above, I would pay it off immediately. FIRECalc and ******** are great tools for quantifying the success rate of your specific mortgage scenario. Just be cautious using all the bullish historical data to evaluate the next 10-15 years. With interest rates at historic lows, I don't think all that historical goodness is a reliable short-term indicator. Many people are quick to tout the current, historic low interest rate environment as justification to hold a mortgage, without realistically thinking through what that means to the other side of the equation.
Lastly, the tax advantage of holding a mortgage is frequently over-valued. I no longer have a mortgage, but when I did, my itemized deductions typically exceeded the standard deduction by about one-fourth the amount of my deductible mortgage interest. At my expected marginal rate of 15% in retirement, the advantage was negligible and would have phased down to zero in just a few years. This is quite easy to project by using your amortization table and applying an inflation factor to the current standard deduction. I'm sure there are scenarios where a meaningful portion (or all) of the deductible mortgage interest exceeds the standard deduction. But given the size of standard deductions these days, I have to believe that is the exception and not the rule.