Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40815 )

Change subject: scons: Enable LTO for opt, perf and prof builds.
......................................................................

scons: Enable LTO for opt, perf and prof builds.

The name of the build is opt, so it should be fully optomized. Also, the
fast build, the only one with LTO historically, is dangerous to use
since it disables many error checks. I personally run gem5 many times
while developing, iterating and trying to fix bugs, and so want it to
run quickly then too, not just the final time when collecting results.

Also, since they mirror the opt build, the perf and prof builds also
have LTO options added.

This has the nice side effect of speeding up the build time of build/X86
significantly (6:20 -> 4:27) due to parallelization of the link, and
reduces the size of the build/X86 directory (with debug compression
enabled) from 3.4GB to 2.8GB.

The size of build/X86/python/_m5 is still 1.6GB, so still more than half
of the total size of build/X86.

Change-Id: I8feabf99454693fdd100d9e1a64fdeae53362f75
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40815
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Earl Ou <shunhsin...@google.com>
---
M SConstruct
M src/SConscript
2 files changed, 3 insertions(+), 7 deletions(-)

Approvals:
  Earl Ou: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index e9dfae5..e1814c3 100755
--- a/SConstruct
+++ b/SConstruct
@@ -358,8 +358,7 @@
     main['GCC_VERSION'] = gcc_version

     # Add the appropriate Link-Time Optimization (LTO) flags
-    # unless LTO is explicitly turned off. Note that these flags
-    # are only used by the fast target.
+    # unless LTO is explicitly turned off.
     if not GetOption('no_lto'):
         # Pass the LTO flag when compiling to produce GIMPLE
         # output, we merely create the flags here and only append
diff --git a/src/SConscript b/src/SConscript
index aeb7038..5fe0ab2 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1341,11 +1341,8 @@
     # the optimization to the ldflags as LTO defers the optimization
     # to link time
     for target in ['opt', 'fast', 'prof', 'perf']:
-        ccflags[target] += ['-O3']
-        ldflags[target] += ['-O3']
-
-    ccflags['fast'] += env['LTO_CCFLAGS']
-    ldflags['fast'] += env['LTO_LDFLAGS']
+        ccflags[target] += ['-O3'] + env['LTO_CCFLAGS']
+        ldflags[target] += ['-O3'] + env['LTO_LDFLAGS']
 elif env['CLANG']:
     ccflags['debug'] += ['-g', '-O0']
     # opt, fast, prof and perf all share the same cc flags

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40815
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8feabf99454693fdd100d9e1a64fdeae53362f75
Gerrit-Change-Number: 40815
Gerrit-PatchSet: 10
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to