Backport Constant-fold Matches.

(cherry picked from commit b60914286d05b0f01307637c64c90c9bca5721c4)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/optimizer/OptimizerCore.scala