getUserCost() currently returns TCC_Free for any extend of a compare (i1) result. It seems this is only true in a limited number of cases where for example two compares are chained. Even in those types of cases it seems unlikely that they are generally free, while they may be in some cases.
This patch therefore suggests removing this special handling of cast of i1. No tests are failing because of this. What remains is to make sure that this does not introduce any performance regressions. It seems that on SystemZ and also preliminary on X86 this looks ok. Some additional benchmarking on more targets (and X86) would be welcome.
If some target actually would want the old behavior, it could override getUserCost().
(This was originally https://reviews.llvm.org/D53373 -- a bit of discussion there)
You don't need this line at all -- the checks below are sufficient.