Bug ID: 84327
           Summary: Copy pasting the documented optimize flags is not
                    equal to -O1
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
          Reporter: xyzdr4gon333 at googlemail dot com
  Target Milestone: ---

Created attachment 43392
Program showing that the single optimization flags don't work as well as O1

My program reduces its runtime from 20s to 5s when using -O1. So I wanted to
know which optimization is responsible for that and used the optimizations
flags found here:

But not even when copy-pasting ALL flags up to -O3 listed there, can I
reproduce the speedup to 5s!

See the attached file which also contains code comments on how I did compile

This seems to be a very long-standing bug (5+ years):

And even after trying to find the difference by using -Q --help=optimizers
which showed this diff:
    <   -fdelayed-branch
    >   -ftree-builtin-call-dce
Even when adding -ftree-builtin-call-dce I still don't get the same speedup
?!?! In fact nothing changes...

    g++ "${O1Flags[@]}" -ftree-builtin-call-dce -std=c++11 optimizeFlags.cpp &&

Tested with:

    g++ (Debian 7.3.0-3) 7.3.0
    g++-8 (Debian 8-20180207-2) 8.0.1 20180207 (experimental) [trunk revision

Reply via email to