Now that we can look at users, we can trivially do this: when we would have otherwise disabled GlobalMerge (currently -O<3), we can just run it for minsize functions, as it's usually a codesize win (see attached numbers).
I'm a bit uneasy with this minsize/CodeGenOpt::Level hybrid, hence this thread; alternatives welcome. Also, minsize only for now, as we're not quite at re-enabling GM everywhere yet (see PR23579). I'm hoping that if and when we do, we can remove this code path, or turn it into cost model heuristics.
And here are some quick numbers (text section size), for -Oz {no-lto,lto}{AArch64,ARM}:
Most interesting is LTO (esp. ARM), where there's quite a few 5-15% size reductions. There aren't many regressions, a few ~1-3%.