问题描述
我知道-O1自动打开某些标志。这些标志可以手动,虽然开启。如果我不指定-O1,应该还是可以通过指定所有-O1开启的标志,以获得-O1优化。
I know that -O1 automatically turns on certain flags. These flags can be turned on manually though. If I don't specify -O1, it should still be possible to get -O1 optimization by specifying all the flags that -O1 turns on.
我试过
-fthread-jumps -fcprop-registers -fguess-branch-probability
但它仍然没有做-O1优化。当我使用gprof的,因为表现并不好,我可以告诉。
but it still does not do -O1 optimization. I can tell when I use gprof because the performance is not as good.
我打开哪个标志,以获得-O1优化?
Which flags do I turn on to get -O1 optimization?
推荐答案
要找出一个方法:
gcc -O1 -c -Q -v dummy.c
(其中dummy.c是你的文件名)。这将导致GCC喷涌用来在命令行标志。
(where dummy.c is your filename.) This causes gcc to spew the flags used to the command line.
编辑:请参阅kastauyra's回答这一点。看样子你不能模拟满 -O1
优化与 -f
单独标志。
Please see kastauyra's answer on this. It appears you cannot simulate full -O1
optimization with -f
flags alone.
这篇关于如何获得的gcc -O1优化不指定-O1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!