Conventional wireless techniques are becoming inadequate for beyond-5G networks due to latency and bandwidth considerations. To improve the error performance of wireless communication systems, we propose physical layer network coding (PNC) in an intelligent reflecting surface (IRS)-assisted environment. We consider an IRS-aided butterfly network, where we propose an algorithm for obtaining the optimal IRS phases. Analytic expressions for the bit error rate (BER) are derived. Numerical results demonstrate that the proposed scheme significantly improves the BER performance. For instance, the BER at the relay in the presence of a 32-element IRS is three orders of magnitudes less than that without an IRS.