This is the mail archive of the
mailing list for the GCC project.
Re: optimization question
- From: Martin Sebor <msebor at redhat dot com>
- To: mark maule <mark dot maule at oracle dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 19 May 2015 09:09:56 -0600
- Subject: Re: optimization question
- Authentication-results: sourceware.org; auth=none
- References: <555A44FC dot 1020506 at oracle dot com> <555A7E48 dot 9080202 at redhat dot com>
I'm not very familiar with the optimizations that are done in O2 vs O1,
or even what happens in these optimizations.
So, I'm wondering if this is a bug, or a subtle valid optimization that
I don't understand. Any help would be appreciated.
Another approach to debugging a suspected optimization bug is
to look at the optimization dumps produced in response to one
or more of the -fdump-tree-xxx and -fdump-rtl-xxx options.
There are many of them and they tend to be verbose but not
as much as the raw assembly and are usually easier to follow.
The dumps make it possible to identify the buggy optimization
pass and avoid the bug by disabling just the problematic
optimization while leaving all the others enabled. With
attribute optimize and/or #pragma GCC optimize, you can then
control specify which optimization to disable for subsets of
functions in a file.
See the following sections in the manual for more: