From 8f66a0353598b871af20fa5e18652365ace92802 Mon Sep 17 00:00:00 2001 From: Chandan Jain Date: Mon, 3 Nov 2025 08:27:06 -0800 Subject: [PATCH] Use -O2 compilation for Autocorrect only (#15425) Summary: Apply -02 compiler flag to make FLLM autocorrect faster Sheet measuring different scopes of applying -02 and the resulting latency https://docs.google.com/spreadsheets/d/1ZnxoRwCIiMz3hXyhgb6sm_2UThBUyq-mpp8RzksfJMQ/edit?usp=sharing Differential Revision: D85152814 --- shim_et/xplat/executorch/build/runtime_wrapper.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shim_et/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl index d03a3f71b3b..0cabf73cbb9 100644 --- a/shim_et/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim_et/xplat/executorch/build/runtime_wrapper.bzl @@ -117,6 +117,12 @@ def _patch_build_mode_flags(kwargs): "ovr_config//os:macos": ["-fvisibility=default"], }) + # Add -O2 compiler flag when the compiler_flag_O2 config is set + kwargs["compiler_flags"] = kwargs["compiler_flags"] + select({ + "DEFAULT": [], + "fbsource//xplat/assistant/oacr/native/scripts:compiler_flag_O2": ["-O2"], + }) + return kwargs def _patch_test_compiler_flags(kwargs):