Enable ThinLTO for dex2oat
This helps reducing binary size as well as improve performance of
dex2oat.
On Marlin (lower clocked cores)
With PGO
dex2oat binary + libraries size:
- no-lto: 9.90MB
- thin-lto: 9.81MB
dex2oat run time for top 25 apps (with speed filter):
Average case: -2.83%
Best case : -4.65%
Worst case : 0.25%, likely noise
Without PGO
dex2oat binary + libraries size:
- no-lto: 9.67MB
- thin-lto: 9.60MB
dex2oat run time for top 25 apps (with speed filter):
Average case : -0.96%
Best case : -2.30%
Worst case : 0.52%, likely noise
Test: Benchmark on Marlin (low-clock cores)
Bug: 62839002
Change-Id: Iad39eae4c222b753dd2dab949a928151ea13e630
diff --git a/compiler/Android.bp b/compiler/Android.bp
index ba08d79..23d5c14 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -256,7 +256,14 @@
instrumentation: true,
profile_file: "art/dex2oat.profdata",
benchmarks: ["dex2oat"],
- }
+ },
+ target: {
+ android: {
+ lto: {
+ thin: true,
+ },
+ },
+ },
}
art_cc_library {
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index dd16ba4..d933e05 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -139,7 +139,14 @@
"-Wno-frame-larger-than=",
"-DART_PGO_INSTRUMENTATION",
],
- }
+ },
+ target: {
+ android: {
+ lto: {
+ thin: true,
+ },
+ },
+ },
}
art_cc_binary {
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index bea61d0..24be25b 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -44,7 +44,14 @@
instrumentation: true,
profile_file: "art/dex2oat.profdata",
benchmarks: ["dex2oat"],
- }
+ },
+ target: {
+ android: {
+ lto: {
+ thin: true,
+ },
+ },
+ },
}
art_cc_library {