A few random observations:
Necrophilia is generally a separate criminal offense in its own right. It is not an activity that would be legal but for a lack of consent.
It is clearly possible, legally speaking, to consent irrevocably to something in a binding manner, and this happens all the time. Sexual intercourse is perhaps one of the few otherwise legal activities where this is impossible.
It is also impossible to give valid consent (irrevocable or otherwise) to an illegal act, of course.
I've never considered the question of irrevocable consent as a defense to, say, rape. Such a defense would never fly, of course, but the possibility occurs to me that part of the traditional common-law definition of rape may actually have evolved to ensure that it couldn't: the twin criteria that the sex be "against [the woman's] will and without her consent". This very old legal phrase always struck me as a little redundant, but upon reflection it expresses a subtle distinction; you could have a situation where consent purporting to be irrevocable had been given, but the sex was nonetheless against the woman's will at the time of the rape.
However, in connection with the foregoing, I'm reminded that at traditional common law, the subject of a rape had to be "a woman not [the defendant's] wife". Clearly, it used to be the case that marriage effectively entailed the woman's irrevocable consent to sexual intercourse with her husband during the marriage - but that was the extent of the exception.
To return to the pleasant subject of necrophilia, I don't see any reason to evaluate the issue in terms of consent. Dead people can't consent to anything, naturally, although living people have some (limited) power to direct certain things after their death, such as the disposition of their mortal remains. However, I would submit that the lack of consent isn't what makes necrophilia unacceptable. A dead person is not a person, legally speaking. We have certain legal and other obligations with regard to dead people, but that doesn't equate to a dead person having rights. Even the enforcement of a will arises not from the dead person's present rights, but the previous rights of the living person he used to be.
In the absence of a necrophilia statute (or other law specifically regarding the treatment of human remains), necrophilia would not run afoul of any sexual criminal laws involving consent. No consent would be needed because, from a legal point of view, there is only one party to a necrophiliac act. It would equate to a form of masturbation.