Do not perform AFDO or optimizing LTO for eng builds
Afdo creates more variants to build, and optimizing LTO is costly to
perform. Turn off these two optimizations for eng builds for a faster
build speed.
This reduces total C/C++ invocation time for aosp_arm64-eng by 6.28%.
Test: presubmit
Bug: 307753064
Change-Id: Ibac4269c66a64e896dba2074b607d71a2da37546
diff --git a/cc/afdo.go b/cc/afdo.go
index 91cf0b8..e7dea0e 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -64,6 +64,13 @@
return []interface{}{&afdo.Properties}
}
+func (afdo *afdo) begin(ctx BaseModuleContext) {
+ // Disable on eng builds for faster build.
+ if ctx.Config().Eng() {
+ afdo.Properties.Afdo = false
+ }
+}
+
// afdoEnabled returns true for binaries and shared libraries
// that set afdo prop to True and there is a profile available
func (afdo *afdo) afdoEnabled() bool {