dE - TdS + pdV = 0 for all infinitesimal changes, reversible or irreversible, because E, T, S, p, V are all functions of state, and depend only on the starting state and finishing state, not on the process of getting from one to the other, provided the change is infinitesimal.
It is also true (first law of thermodynamics) that, in any process, dE - Q + W = 0, in which Q is the heat input and W is the work done by the system.
In a reversible process, W = pdV and Q = TdS. In an irreversible process, W < pdV and Q < TdS. [An extreme case of an irreversible change would be the expansion of a thermally isolated gas into a vacuum. Here pdV has a positive value but W is zero. TdS has a positive value equal to pdV, but Q is zero. Thus both equations give dE = 0, which is correct because the system is thermally isolated and does no work.]
[This is a corrected version of the earlier post. Note the sign convention I'm using for W. Should this post be re-written for the opposite sign convention?]