Add Cast() case in OptimizerCore.pretransformExpr().

This is necessary for a Cast(expr) not to force expr if the
result of the Cast is not used.