This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/64753] Redundant cmp instruction on x86_64
- From: "rv at rasmusvillemoes dot dk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Jan 2015 12:57:59 +0000
- Subject: [Bug target/64753] Redundant cmp instruction on x86_64
- Auto-submitted: auto-generated
- References: <bug-64753-4 at http dot gcc dot gnu dot org/bugzilla/>
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.