M
M
Mercury132018-07-10 15:57:02
MinGW
Mercury13, 2018-07-10 15:57:02

What optimization to turn off in g++ -O1 so that there is no [optimized out]?

Building G++ in -O1 is faster than in -O0: compilation of one file and full linking takes 11 seconds instead of 18. However, the debugger writes <optimized out> for many variables
Which of the optimizations to disable (and whether it can be done at all) so that these < optimized out> was not, but to keep a fast build?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2018-07-10
@Mercury13

-fno-tree-* (generally, anything that starts with tree and goes into O1).
It is pointless to single out further, each of them does something small.
But don't include -fno-tree-copy-prop, it outputs a hell of a bunch of false alarms.
UPD. Currently, it's better to use the LLD linker, period. The project has grown, and the linking takes “whole” TWO seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question