Hi Paul,

> > Does gcc's warning message give a hint how the compiler options could
> > be adjusted, so as to enable the optimization?
> 
> Unfortunately not, at least not to me. Here's the diagnostic:
> 
> bytecode.c: In function ‘exec_byte_code’:
> bytecode.c:1792:1: error: fold-mem-offsets: 419 basic blocks and 52 
> edges/basic block [-Werror=disabled-optimization]
>   1792 | }
>        | ^

Thanks.

Looking for the -Wdisabled-optimization warnings in GCC:
$ grep -r OPT_Wdisabled_optimization .
./gcc/gcse.cc:      warning (OPT_Wdisabled_optimization,
./gcc/gcse.cc:      warning (OPT_Wdisabled_optimization,
./gcc/tree-switch-conversion.cc:    warning_at (gimple_location (m_switch), 
OPT_Wdisabled_optimization,
./gcc/tree-ssa-loop-prefetch.cc:          warning (OPT_Wdisabled_optimization,
./gcc/ext-dce.cc:      warning (OPT_Wdisabled_optimization,
./gcc/fold-mem-offsets.cc:      warning (OPT_Wdisabled_optimization,
./gcc/tree-vrp.cc:        warning (OPT_Wdisabled_optimization,

Some of them come with a hint, which parameter can be adjusted.
Some, like this one, are based on a condition with a fixed limit.

What is common, though, is that the disabled optimization is only
one (minor) optimization among many. Therefore, even if the affected
function is the bytecode interpreter or the display engine, the
negative effects are small, maybe not even measurable.

For instance, in this case, the "fold-mem-offsets" optimization
is described as [1]:
  "Try to eliminate add instructions by folding them in memory loads/stores."
This is a minor optimization, because add instructions are executed
in the CPU, with no effect on cache misses or branches.

Therefore, I agree to disable this warning option.

Bruno

[1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html




Reply via email to