My FIL suffered with vascular dementia for 10 years. For most of the 5 years he was in our care, we made sure he (and we) ate a healthy diet. His body was healthy but his mind continued to go. His final year with us we gave him ice cream every day. It was one of the few pleasures he had left. That and music.
The rest of the day he was agitated, yelling, crying for his parents, scared and confused. He forgot how to walk, talk, and finally how to eat.
There are studies behind this too. I read several studies at the time which suggested that the ability to taste sweets was the last taste sensation to go.
There is a point in caregiving that you come to the understanding that making them comfortable supersedes the desire to prolong their life, when it is misery for them.
Wow, that was rough on you; bless you for taking care of him.