Add global option filtering for FDO builds.

Change-Id: I95e797f7f5945bb34061d17e49156ca8c8a19854
(cherry picked from commit c7ed00fc00)
This commit is contained in:
Dehao Chen 2014-09-19 10:18:12 -07:00 committed by Ying Wang
parent 6bef5124b7
commit 295a6d27f6

View file

@ -184,9 +184,11 @@ endif
my_compiler_dependencies :=
####################################################
##################################################################
## Add FDO flags if FDO is turned on and supported
####################################################
## Please note that we will do option filtering during FDO build.
## i.e. Os->O2, remove -fno-early-inline and -finline-limit.
##################################################################
ifeq ($(strip $(LOCAL_FDO_SUPPORT)), true)
ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
@ -923,6 +925,21 @@ my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flag
my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
endif
ifeq ($(LOCAL_FDO_SUPPORT), true)
build_with_fdo := false
ifeq ($(BUILD_FDO_INSTRUMENT), true)
build_with_fdo := true
endif
ifeq ($(BUILD_FDO_OPTIMIZE), true)
build_with_fdo := true
endif
ifeq ($(build_with_fdo), true)
my_cflags := $(patsubst -Os,-O2,$(my_cflags))
fdo_incompatible_flags=-fno-early-inlining -finline-limit=%
my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)