Turns out that neither GCC 4.8 nor LLVM 3.3 implement this optimization. Apparently, nobody ever writes C code like this.