[Bug target/64753] Redundant cmp instruction on x86_64

rv at rasmusvillemoes dot dk gcc-bugzilla@gcc.gnu.org
Wed Jan 28 12:58:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64753

--- Comment #1 from Rasmus Villemoes <rv at rasmusvillemoes dot dk> ---
FWIW, I wrote a stupid script looking for the pattern

  <test/cmp instruction>
  <(conditional) jump to abcd>
...
  abcd: <same test/cmp instruction>

Compiling a defconfig linux kernel with gcc 4.7 gives 201 instances, 5.0 gives
252. The second test/cmp may not be redundant in all cases, but at least the
jump target could be adjusted to the instruction following abcd. I filtered out
cases where the jump itself was a jump target (so the only path to it is
through the preceding test/cmp), though that didn't actually remove anything.



More information about the Gcc-bugs mailing list