There are two decisions from the United States Supreme Court which suggest that a confession may be inadmissible if it is tainted by the illegal investigation arising from an illegal arrest. Many more have evolved since the United States Wong Sun case back in 1963. The so called Wong Sun doctrine suggests that statements given to the police by a person who is under illegal arrest will be barred from admissibility unless it can be demonstrated by the prosecution that the taint arresting from the illegal arrest and illegal custody is dissipated and purged.
The issue is whether the evidence has been come at by exploitation of the illegal arrest and illegal detention or by means that are sufficiently distinguishable to be purged of the primary taint arising from the illegal arrest and illegal detention.
The Wong Sun case indicated that there may be events short of release from custody which taken together can operate to purge the taint of the illegal arrest and illegal detention. One such event obviously would be the Miranda Warnings. Another might be the taking of a defendant before a magistrate for the purpose of having set bail.