In FreeBSD, we have a particular piece of code, a boot loader, which must always fit in 7 kiB, so it is compiled with -Os, and various other parameters that minimize its size.
When I recently started working on importing clang 3.5.0 into the FreeBSD base system, I noticed that the code grew substantially when compiled with 3.5.0. Previously, with clang 3.4.1, it was 31 bytes below the limit of 7168 bytes, but with 3.5.0 it went 145 bytes over the limit. This is an increase of 176 bytes!
I bisected llvm trunk, and found that r195496 introduced this regression. The problem is that X86TargetLowering::EmitCmp() now expands comparisons to 32-bit operations, even with -Os. This is because it only checks for one possible size optimization attribute:
MinSize is only in effect for -Oz. It should also check for Attribute::OptimizeForSize, which is in effect for -Os.
This diff adds the additional check, and fixes the original problem for me with the FreeBSD boot loader, which is compiled to its previous size again.