Make dead code elimination work for non case lambdas.

Related to PR14138.