From 178682e3690dc385c23139c49b6b7a417d54337c Mon Sep 17 00:00:00 2001 From: tianyunlong Date: Mon, 25 Sep 2023 11:47:16 +0800 Subject: [PATCH] Add Profile-Guided Optimization for ark_jsruntime Signed-off-by: tianyunlong --- BUILD.gn | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 7dc65ff851..4188b74803 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1190,6 +1190,16 @@ ohos_shared_library("libark_jsruntime_test") { public_configs = [ "$js_root:ark_jsruntime_public_config" ] public_configs += [ ":include_llvm" ] + if (is_ohos && is_clang && enable_pgo && + (target_cpu == "arm" || target_cpu == "arm64")) { + cflags = [ + "-fprofile-use=/path/to/profdata", + "-Wno-error=backend-plugin", + "-Wno-profile-instr-out-of-date", + "-Wno-profile-instr-unprofiled", + ] + } + ldflags = [] if (enable_coverage) { ldflags += [ "--coverage" ] -- Gitee