The more than decennnial rtl-optimization/19705 - -fno-branch-count-reg doesn't prevent decrement and branch instructions on a count register points out that the documentation of the option leads one to expect that it prevents the decrement and branch instruction from appearing in the instruction stream. This isn't the case The option prevents a dedicated pass from running that introduces such instructions, but it doesn't prevent other passes from introducing it. The attached updates the documentation to clarify this.
Martin
PR rtl-optimization/19705 - -fno-branch-count-reg doesn't prevent decrement and branch instructions on a count register gcc/ChangeLog: 2016-02-11 Martin Sebor <mse...@redhat.com> PR rtl-optimization/19705 * doc/invoke.texi (Options That Control Optimization): Clarify -fno-branch-count-reg. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 233355) +++ gcc/doc/invoke.texi (working copy) @@ -6513,11 +6513,14 @@ life-range analysis. This option is eff @item -fno-branch-count-reg @opindex fno-branch-count-reg -Do not use ``decrement and branch'' instructions on a count register, -but instead generate a sequence of instructions that decrement a -register, compare it against zero, then branch based upon the result. -This option is only meaningful on architectures that support such -instructions, which include x86, PowerPC, IA-64 and S/390. +Avoid running a pass scanning for opportunities to use ``decrement and +branch'' instructions on a count register instead of generating sequences +of instructions that decrement a register, compare it against zero, and +then branch based upon the result. This option is only meaningful on +architectures that support such instructions, which include x86, PowerPC, +IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option +doesn't remove the decrement and branch instructions from the generated +instruction stream introduced by other optimization passes. Enabled by default at @option{-O1} and higher.