[PATCH] D58075: [gn build] Separate debug and optimization settings

David Major via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 12 14:24:30 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL353888: [gn build] Separate debug and optimization settings (authored by dmajor, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58075?vs=186331&id=186543#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58075/new/

https://reviews.llvm.org/D58075

Files:
  llvm/trunk/utils/gn/build/BUILD.gn
  llvm/trunk/utils/gn/build/buildflags.gni


Index: llvm/trunk/utils/gn/build/buildflags.gni
===================================================================
--- llvm/trunk/utils/gn/build/buildflags.gni
+++ llvm/trunk/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
 }
Index: llvm/trunk/utils/gn/build/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/build/BUILD.gn
+++ llvm/trunk/utils/gn/build/BUILD.gn
@@ -23,7 +23,8 @@
   if (host_os != "win") {
     if (is_debug) {
       cflags += [ "-g" ]
-    } else {
+    }
+    if (is_optimized) {
       cflags += [ "-O3" ]
     }
     cflags += [ "-fdiagnostics-color" ]
@@ -39,11 +40,16 @@
         "/FS",
       ]
       ldflags += [ "/DEBUG" ]
-    } else {
+    }
+    if (is_optimized) {
       cflags += [
         "/O2",
         "/Zc:inline",
       ]
+      ldflags += [
+        "/OPT:REF",
+        "/OPT:ICF",
+      ]
     }
     defines += [
       "_CRT_SECURE_NO_DEPRECATE",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58075.186543.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190212/6d2815b1/attachment.bin>


More information about the llvm-commits mailing list