[PATCH] D79916: Map -O to -O1 instead of -O2
Jessica Clarke via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 17 05:24:55 PDT 2020
jrtc27 added subscribers: trasz, dim, jrtc27.
jrtc27 added a comment.
Herald added a subscriber: dang.
This has significantly regressed FreeBSD's performance with the new version of Clang. It seems Clang does not inline functions at -O1, unlike GCC, and since FreeBSD currently compiles its kernel with -O whenever debug symbols are enabled[1], this results in all its `static inline` helper functions not being inlined at all, a pattern that is common in the kernel, used for things like `get_curthread` and the atomics implementations.
[1] This is a dubious decision made r140400 in 2005 to provide "truer debugger stack traces" (well, before then there was ping-ponging between -O and -O2 based on concerns around correctness vs performance, but amd64 is an exception that has always used -O2 since r127180 it seems). Given that GCC will inline at -O, at least these days, the motivation seems to no longer exist, and compiling a kernel at anything other than -O2 (or maybe -O3) seems like a silly thing to do, but nevertheless it's what is currently done.
Cc: @dim @trasz
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79916/new/
https://reviews.llvm.org/D79916
More information about the cfe-commits
mailing list