Why can one use this equation for entropy if this process is irreversible? The equation 
$$dS = \dfrac{dQ}{T}$$
is said do hold only on reversible processes. Indeed this is almost always emphasized by writing
$$dS = \dfrac{dQ_{\mathrm{rev}}}{T},$$
to be clear that this is during one reversible process.
Now there are some irreversible processes on which this is used. For instance, if one mass $m$ of a substance melts at temperature $T_0$ and if it has latent heat of fusion $q_L$ then it is usually computed that 
$$\Delta S = \dfrac{mq_L}{T_0}.$$
Another example is when heat enters a system at constant temperature. In that case if the heat is $Q$ we have
$$\Delta S = \dfrac{Q}{T}.$$
All these processes are clearly irreversible. It is intuitively clear, but more than that we have $\Delta S > 0$ in all of them.
Still we are finding $\Delta S$ using
$$\Delta S = \int \dfrac{dQ}{T},$$
and it is obviously that this integral is being carried along irreversible processes in the examples I gave.
In that case, whey can we use this formula to find the change in entropy if the processes are irreversible?
 A: Entropy $S$ is a state function.
It only depends on the final and initial states, and not on how the state was reached.

The Clausius' Inequality states
$$\oint \frac{đQ_\textrm{system}}{T_\textrm{source}}\leqq 0\,.\tag{I }$$
When the cycle is reversible, $T_\textrm{source}~=~ T_\textrm{system}$ and equality of $\rm(I)$ applies i.e.,
$$\oint \frac{đQ_\textrm{system}}{T_\textrm{system}} = 0\tag{I.i}$$
It is a matter of few steps from $\rm(I.i)$ to show that the integral $\displaystyle\int \dfrac{đQ}{T}$ takes the same value for two different reversible paths.
So, we can define $S(\rm A) = \displaystyle\int_{\rm O_\textrm{reference state}}^{\rm A}~ \dfrac{đQ_\textrm{rev}}{T_\textrm{system}}$  i.e., for a reversible transformation.
Now, consider two paths equilibrium states $\rm A$ and $\rm B$ such that $\mathsf I$ connecting $\rm A$and $\rm B$ is arbitrary path (reversible or irreversible)  and  the second path $\mathsf I^\prime$ connecting $\rm B$ and $\rm A$ is reversible.
So, using $\rm(I),$ we get
$$\begin{align} \oint_{\mathrm A \mathsf I \mathrm B \mathsf{^\prime}\mathrm A } \frac{đQ}{T} & \leqq 0 \\ \implies~~~~~~~~~~~~~~~  \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}} + \left (\int_{\mathrm B}^{\mathrm A} \frac{đQ}{T}\right)_{\mathsf{I^\prime}} & \leqq 0\\\implies \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}} - \left[\int_{\mathrm O}^{\mathrm B}\frac{đQ}{T}-\int_{\mathrm O}^{\mathrm A}   \frac{đQ}{T}\right]&\leqq 0~~~~~~~~~~~~~~~~~~~~~(\mathsf I^\prime~\textrm{is reversible})\\ \implies~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ S(\mathrm B)- S(\mathrm A)&\geqq \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}}\tag{II}\end{align}$$
From $\rm (II)$
$$S(\mathrm B)-S(\mathrm A)~=~\left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}}~~~\textrm{iff}~~~\mathsf I ~\textrm{is a reversible transformation}$$ that is, $$S(\mathrm B)-S(\mathrm A)~=~\int_{\mathrm A}^{\mathrm B} \frac{đQ_\textrm{rev}}{T}\tag{III.i}$$
When $\sf{ I}$ is irreversible, then from $\rm{(II)}$
$$S(\mathrm B)-S(\mathrm A)\gt \int_{\mathrm A}^{\mathrm B} \frac{đQ_\textrm{irrev}}{T}$$
More precisely, using the first law $$\mathrm dS= \dfrac{\textrm{đ} q_\textrm{irrev}}{T}+ \dfrac{\left [ \textrm{đ} w_\textrm{rev}-\textrm{đ} w_\textrm{irrev}\right]}{T}\;.\tag{III.ii}$$
Both $\rm{(III.i)}$ and $\rm{(III.ii)}$ would yield the same entropy change as after-all entropy $S$ is a state function.
But which of $\rm{(III.i)}$ and $\rm{(III.ii)}$ would one use to compute the change in entropy?
Think.

References:
$\bullet$ Thermodynamics by Enrico Fermi.
A: When a system at constant temperature $T$ receives (loses) heat $Q$, the system's gain (loss) of entropy $\textit{due to this particular operation}$ of heating addition (removal) may indeed be written as $\Delta S_{heating/cooling}=\frac{Q}{T}$. Such a situation occurs during phase change. However this is only one mechanism by which a system's entropy may change; entropy of a system can also change due to flux  of mass which carries entropy; dissipative processes such as friction generate entropy all on its own. 
To show that a process is reversible (irreversible), you must show that entropy of system+surroundings remains the same (increases). Just from knowledge of $\Delta S_{heating/cooling}$ pertaining to the system you cannot conclude anything.
