summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Major <dmajor@mozilla.com>2019-02-12 22:24:45 +0000
committerDavid Major <dmajor@mozilla.com>2019-02-12 22:24:45 +0000
commit5b07e304088582b9fae76a8f96ca5bfe21d9d99f (patch)
tree8140544f25d9487c2c5f1b47fc4b345b100ddd27
parent16a0fba741f44d84807fecdc7c2b50090140225d (diff)
downloadbcm5719-llvm-5b07e304088582b9fae76a8f96ca5bfe21d9d99f.tar.gz
bcm5719-llvm-5b07e304088582b9fae76a8f96ca5bfe21d9d99f.zip
[gn build] Separate debug and optimization settings
This patch adds an `is_optimized` variable, orthogonal to `is_debug`, to allow for a gn analogue to `RelWithDebInfo` builds. As part of this we'll want to explicitly enable GC+ICF, for the sake of `is_debug && is_optimized` builds. The flags normally default to true except that if you pass `/DEBUG` they default to false. Differential Revision: https://reviews.llvm.org/D58075 llvm-svn: 353888
-rw-r--r--llvm/utils/gn/build/BUILD.gn10
-rw-r--r--llvm/utils/gn/build/buildflags.gni5
2 files changed, 12 insertions, 3 deletions
diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index e323f99ac65..91ea275b3fe 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -23,7 +23,8 @@ config("compiler_defaults") {
if (host_os != "win") {
if (is_debug) {
cflags += [ "-g" ]
- } else {
+ }
+ if (is_optimized) {
cflags += [ "-O3" ]
}
cflags += [ "-fdiagnostics-color" ]
@@ -39,11 +40,16 @@ config("compiler_defaults") {
"/FS",
]
ldflags += [ "/DEBUG" ]
- } else {
+ }
+ if (is_optimized) {
cflags += [
"/O2",
"/Zc:inline",
]
+ ldflags += [
+ "/OPT:REF",
+ "/OPT:ICF",
+ ]
}
defines += [
"_CRT_SECURE_NO_DEPRECATE",
diff --git a/llvm/utils/gn/build/buildflags.gni b/llvm/utils/gn/build/buildflags.gni
index a28b788418d..4dcdc962b7d 100644
--- a/llvm/utils/gn/build/buildflags.gni
+++ b/llvm/utils/gn/build/buildflags.gni
@@ -1,10 +1,13 @@
declare_args() {
- # Whether to build with debug information and without optimizations.
+ # Whether to build with debug information.
is_debug = false
}
# args that depend on other args must live in a later declare_args() block.
declare_args() {
+ # Whether to build with optimizations.
+ is_optimized = !is_debug
+
# Whether to enable assertions.
llvm_enable_assertions = true
}
OpenPOWER on IntegriCloud