This PR add Expr-size rules that compute the size of a Expr, which Loop invariant hoisting depends on.
Something I'm concerning is what should be counted. I don't count the Cons and Nil constructor in List, and also don't count the Get and All constructor. Alternative interpretations could be:
Any constructor is counted.
Only things that have cost of computation will be counted, which will remove the size of Let, Num, Bool, Arg, and cost of Switch should be size (or cost?) of pred + max cost of branches.
It could also change to Expr-cost instead of size, which give each operation different cost. (or have Expr-size and Expr-cost at same time)
@oflatt Do you think any alternative Expr-size mentioned above would make more sense, or this one is (not counting list, Get, and All) is good for now?
This PR add Expr-size rules that compute the size of a Expr, which Loop invariant hoisting depends on. Something I'm concerning is what should be counted. I don't count the Cons and Nil constructor in List, and also don't count the Get and All constructor. Alternative interpretations could be: