Enable LTO for release builds

This should reduce the final binary size and improve performance.

Change-Id: Ic73082b77f7bee6959d33464496b57c433bfc57c
Reviewed-on: https://gn-review.googlesource.com/c/3742
Commit-Queue: Petr Hosek <phosek@google.com>
Reviewed-by: Scott Graham <scottmg@chromium.org>
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json
index 6abc913..7a91854 100644
--- a/infra/recipes/gn.expected/ci_linux.json
+++ b/infra/recipes/gn.expected/ci_linux.json
@@ -154,7 +154,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/ci_mac.json b/infra/recipes/gn.expected/ci_mac.json
index c2398c7..ff804dd 100644
--- a/infra/recipes/gn.expected/ci_mac.json
+++ b/infra/recipes/gn.expected/ci_mac.json
@@ -211,7 +211,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/ci_win.json b/infra/recipes/gn.expected/ci_win.json
index b68df04..a565841 100644
--- a/infra/recipes/gn.expected/ci_win.json
+++ b/infra/recipes/gn.expected/ci_win.json
@@ -245,7 +245,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]\\gn\\build\\gen.py"
+      "[START_DIR]\\gn\\build\\gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]\\gn",
     "env": {
diff --git a/infra/recipes/gn.expected/cipd_exists.json b/infra/recipes/gn.expected/cipd_exists.json
index e1c3baf..4c2bd96 100644
--- a/infra/recipes/gn.expected/cipd_exists.json
+++ b/infra/recipes/gn.expected/cipd_exists.json
@@ -154,7 +154,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/cipd_register.json b/infra/recipes/gn.expected/cipd_register.json
index 36985d4..4e562db 100644
--- a/infra/recipes/gn.expected/cipd_register.json
+++ b/infra/recipes/gn.expected/cipd_register.json
@@ -154,7 +154,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json
index 6154c08..452b8fd 100644
--- a/infra/recipes/gn.expected/cq_linux.json
+++ b/infra/recipes/gn.expected/cq_linux.json
@@ -181,7 +181,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/cq_mac.json b/infra/recipes/gn.expected/cq_mac.json
index 64234cc..85a4b13 100644
--- a/infra/recipes/gn.expected/cq_mac.json
+++ b/infra/recipes/gn.expected/cq_mac.json
@@ -238,7 +238,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]/gn/build/gen.py"
+      "[START_DIR]/gn/build/gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]/gn",
     "env": {
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json
index 658c445..21f6dd2 100644
--- a/infra/recipes/gn.expected/cq_win.json
+++ b/infra/recipes/gn.expected/cq_win.json
@@ -272,7 +272,8 @@
     "cmd": [
       "python",
       "-u",
-      "[START_DIR]\\gn\\build\\gen.py"
+      "[START_DIR]\\gn\\build\\gen.py",
+      "--use-lto"
     ],
     "cwd": "[START_DIR]\\gn",
     "env": {
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index 15c404a..f3280c0 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -69,7 +69,7 @@
       },
       {
           'name': 'release',
-          'args': []
+          'args': ['--use-lto']
       },
   ]