Why is there cornstarch in powdered sugar? I was looking up how to make my own powdered/confectioner/icing sugar. Some 'recipes' say that you should add a bit of cornstarch while others just leave this out.

So what is the role of cornstarch? Does it act like a filler (since it's cheaper than sugar)? Is it to prevent lumps? Does it help with texture? Does it do something else?

If this question is too broad, assume I'm only talking about frosting, since that's a frequent use of this sugar.
It's to prevent caking. See, for example, the second FAQ on Domino Sugar's website:


  It is not recommended to substitute confectioners sugar for granulated
  sugar. Since confectioners sugar has a much finer texture, and it
  contains a small percentage of cornstarch to prevent caking,
  substituting can give you unexpected results.


Many shredded cheeses include corn starch for the same reason.