Upvote:1
Both the United Kingdom and the Republic of Ireland have a common Immigration policy called the Common Travel Area.
This Answer goes into further details.
Although both countries may have different policies for Foreigners, in most cases where a British Visa or leave to enter exists, no Irish visa is needed and vice versa.
Leaving Ireland with a valid British leave to enter should cause no problem.
Check the Wikipedia article if your country is listed.