Justin Tipuric inspired Wales to a bruising victory against Ireland in an fiercely-contested World Cup warm-up in Dublin.