Garbage doctrine: Those born without the law (i.e. those whose bodily defects prevent them from truly knowing right and wrong) and those who die in infancy were spirits that were so righteous that Heavenly Father made them that way so that Satan couldn't tempt them.
Well, that was a pretty icky statement, let's see if we can't do better.
True doctrine: President [Joseph] Smith read the 14th chapter of Revelation, and said--We have again the warning voice sounded in our midst, which shows the uncertainty of human life; and in my leisure moments I have meditated upon the subject, and asked the question, why it is that infants, innocent children, are taken away from us, especially those that seem to be the most intelligent and interesting. The strongest reasons that present themselves to my mind are these: This world is a very wicked world; and it is a proverb that the "world grows weaker and wiser"; if that is the case, the world grows more wicked and corrupt. In the earlier ages of the world a righteous man, and a man of God and of intelligence, had a better chance to do good, to be believed and received than at the present day; but in these days such a man is much opposed and persecuted by most of the inhabitants of the earth, and he has much sorrow to pass through here. The Lord takes many away even in infancy, that they may escape the envy of man, and the sorrows and evils of this present world; they were too pure, too lovely, to live on earth; therefore, if rightly considered, instead of mourning we have reason to rejoice as they are delivered from evil, and we shall soon have them again. (TPJS page 196)