compiler: ensure evaluation order in type hash/eq functions

The type hash and equality functions are generated after the
order_evaluations pass. They may contain shortcut operators and
Set_and_use_temporary_expressions (e.g. from lowering a
Binary_exprssion) that need to be ordered. Run order_evaluations
and remove_shortcuts on these functions. (The hash functions
may be fine, but to be on the safe side we run on them anyway.
We do need to run on the equality functions.)

A Set_and_use_temporary_expression is effectively an assignment,
so it needs to be ordered. Otherwise if we insert a temporary
statement before it, we may get wrong evaluation order.

A test case is CL 185818.

Fixes golang/go#33062.

Change-Id: I165f7e2c690d1cc7fa55fb23e5621320cf58bd77
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 files changed