Evolutionary basis for self-delusion?

David Byrne posted a thought-provoking rumination on the evolutionary basis for religion and other forms of self-delusion -- it may help us live longer if we can fool ourselves into thinking that life has a point:
The truth may set you free, but you might not be as carefree and happy. It will eat away at you – what hurts you does not necessarily make you stronger.

I would maintain that a healthy (i.e. substantial) amount of denial is therefore genetically heritable, that it allows us to blithely go on (despite reading Beckett) and to ignore the basic sadness and desperation of life. We can live in an illusion – in fact we are genetically predisposed to do so. These illusions can be small – I am just as good at catching game as Bob, my rival, for example – or they can be very large – that death is not the end and that I will be rewarded for my faith and Bob, the apostate, will rot in Hell.

Either way, they allow me to go on, to persevere in the face of unlikely odds or limited chance of success. We have evolved to be less rational that one might think, and to be slightly more delusional and even stupid.