https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124624
--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> --- I'm pretty sure it can invert. It's even got code that's supposed to handle this kind of scenario, in fact it's supposed to strongly prefer generating Kang-Che's desired code when optimizing for size.
