Change clang frontend optimization level from 0 to 2
authorYonghong Song <yhs@fb.com>
Mon, 12 Jun 2017 01:37:25 +0000 (18:37 -0700)
committerBrenden Blanco <bblanco@gmail.com>
Mon, 19 Jun 2017 23:42:41 +0000 (16:42 -0700)
commit42c00adb4181920d3e52f01e5020686ef470d6ce
treec89954c38b5317dbc78d7a6a6c6fabba18f58311
parent1e0e0fca842c1d6c2dd496f3a47c4fd8540e81ba
Change clang frontend optimization level from 0 to 2

The issue is caused by the following clang change on 5.0:
https://reviews.llvm.org/D28404

Basically, at -O0, unless always inlining is specified, a
function will be marked as optnone and noinline.

This causes two kinds of issues: (1). optnone will generate
suboptimal code with heavy stack use and this high likely can
cause verifier failure; and (2). even if user mark all his/her
defined functions in bpf program as always inlining, some
functions in linux header files are not marked as always inline
and hence will be marked as noinline instead, ultimately
causing llvm complaining about global function reference.

This patch bumps the clang optimization level to -O2.
This should work with older versions of llvm as well.

Signed-off-by: Yonghong Song <yhs@fb.com>
src/cc/frontends/clang/loader.cc