I forwent popcorn and soda for Avengers Endgame cause I didn't wanna get up to go to the bathroom. Just took tiny sips of water when my mouth got dry. Worked like a charm.
Unless your body is already quite dehydrated, this strategy will be hit-or-miss on it's own. Improvenent is possibe by combining the above with relieving yourself immediately before the performance begins. If you relieve immediately beforehand and can't hold it for 90 minutes, there is likely a medical issue (e.g. old man, pregnant, etc).
Avengers Endgame is 3 hours and 1 minute long.
Some of that is credits, and maybe you should be able to hold it for 3 hours anyway, but some people do have medical problems. They should still be allowed to enjoy movies.