It does not affect your stamp 4. However, you are obliged to apply for a new stamp when you have your new passport.
Say for example, if your Stamp 4 permission should be valid for 5 years, but because your passport expires in 2 years, they will give you a stamp 4 that is valid till the expiry day of your passport.
Once you get your new passport, you need to contact INIS to transfer the remaining 3 years of validity to your new passport.
See Q53 for details regarding how to apply for this.
http://www.inis.gov.ie/en/INIS/Immigrat ... 9-FAQ4.pdf