[JIT][Reland] add list() support (#42382)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/40869
Resubmit of https://github.com/pytorch/pytorch/pull/33818.
Adds support for `list()` by desugaring it to a list comprehension.
Last time I landed this it made one of the tests slow, and got unlanded. I think that's bc the previous PR changed the emission of `list()` on a list input or a str input to a list comprehension, which is the more general way of emitting `list()`, but also a little bit slower. I updated this version to emit to the builtin operators for these two case. Hopefully it can land without being reverted this time...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42382
Reviewed By: navahgar
Differential Revision: D24767674
Pulled By: eellison
fbshipit-source-id: a1aa3d104499226b28f47c3698386d365809c23c