The aim of this article is to save the energy consumption and tasks’ completion time of multi-unmanned aerial vehicle (UAV) by jointly optimizing the trajectories of UAVs and passive phase shifts of intelligent reflecting surface (IRS)s. By applying this approach, the system will lead to complex optimization problem as it has several optimization subproblems like optimization of deployment of stop points (SPs), the optimization of association among Internet of Things devices (IoTDs), SPs, and UAVs, the passive phase shifts of IRSs, and the trajectories planning of UAVs. A trajectory planning and passive beamforming algorithm with variable population size (TPPBA-VP) is proposed to tackle the complex optimization problem via four phases taking into accounts all the above optimization concerns. Simulation results demonstrate that the proposed TPPBA-VP is superior than the compared algorithms in terms of reducing the sum of the energy consumption and tasks’ completion time of UAVs.