pan/mdg: Ensure we don't DCE into impossible masks