InstCombine currently performs a constant folding attempt as part of the main InstCombine loop, before visiting the instruction. However, each visit method will also attempt to simplify the instruction, which will in turn constant fold it. (Additionally, we also constant fold instructions before the main InstCombine loop and use a constant folding IR builder, so this is doubly redundant.)
There is one place where InstCombine visit methods currently don't call into simplification, and that's casts. To be conservative, I've added an explicit constant folding call there (though it has no impact on tests).
This makes for a mild compile-time improvement (http://llvm-compile-time-tracker.com/compare.php?from=b15d70e57a440c37c11b0ad3173d7dc624e4fa07&to=1753e2859139af9a8a8551780c791e53ad20f90d&stat=instructions:u) and in particular mitigates the compile-time regression from enabling load simplification in https://github.com/llvm/llvm-project/commit/be88b5814d9efce131dbc0c8e288907e2e6c89be.
The reason for this change is that select constant folding in InstSimplify will only return if the select actually folds, not if it would create a constant expression. Arguably this is a bug in InstSimplify, but I decided not to fix it, since we don't actually want these select constant expressions.