Change Bazel's LIPO model to support dynamic configurations.
The key change is to eliminate the need to transition from the data to the target configuration by relying on out-of-band configuration state. Specifically, the old model drops LIPO options from the data configuration. In the cases when we have to switch back (i.e. TARGET_CONFIG_FOR_LIPO), those options have to get re-injected somehow. Static configurations achieve this with the global configuration transitions table. But dynamic configs have no comparable source (and they consciously eschew global state).
This cl changes the model to *keep* LIPO settings in the data config, then use a new "enableOrDisable" flag to determine whether or not to actually use them. With this model, the data -> target transition is now as simple as toggling that flag.
This change doesn't actually add dynamic config LIPO support. It's doing enough as it is, and we need to make sure it doesn't break existing LIPO semantics. Dynamic support will come as a followup.
PiperOrigin-RevId: 153504240
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
index 4374820..d5393c5 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
@@ -37,6 +37,7 @@
import static com.google.devtools.build.lib.syntax.Type.STRING;
import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
+import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
@@ -44,7 +45,6 @@
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.packages.Attribute;
-import com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition;
import com.google.devtools.build.lib.packages.Attribute.LateBoundLabel;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.BuildType;
@@ -75,28 +75,15 @@
new RuleClass.Configurator<BuildConfiguration, Rule>() {
@Override
public BuildConfiguration apply(Rule rule, BuildConfiguration configuration) {
- if (configuration.useDynamicConfigurations()) {
- // Dynamic configurations don't currently work with LIPO. partially because of lack of
- // support for TARGET_CONFIG_FOR_LIPO. We can't check for LIPO here because we have
- // to apply TARGET_CONFIG_FOR_LIPO to determine it, So we just assume LIPO is disabled.
- // This is safe because Bazel errors out if the two options are combined.
- return configuration;
- }
+ Preconditions.checkState(!configuration.useDynamicConfigurations(),
+ "Dynamic configurations don't use rule class configurators for LIPO");
BuildConfiguration toplevelConfig =
configuration.getConfiguration(LipoTransition.TARGET_CONFIG_FOR_LIPO);
- // If LIPO is enabled, override the default configuration.
+ CppConfiguration cppConfig = configuration.getFragment(CppConfiguration.class);
if (toplevelConfig != null
- && toplevelConfig.getFragment(CppConfiguration.class).isLipoOptimization()
- && !configuration.isHostConfiguration()
- && !configuration.getFragment(CppConfiguration.class).isLipoContextCollector()) {
- // Switch back to data when the cc_binary is not the LIPO context.
- return (rule.getLabel()
- .equals(
- toplevelConfig.getFragment(CppConfiguration.class).getLipoContextLabel()))
- ? toplevelConfig
- : configuration
- .getTransitions()
- .getStaticConfiguration(ConfigurationTransition.DATA);
+ && cppConfig.isDataConfigurationForLipoOptimization()
+ && rule.getLabel().equals(cppConfig.getLipoContextForBuild())) {
+ return toplevelConfig;
}
return configuration;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index 4d3decb..95efb13 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -16,6 +16,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate;
+import com.google.common.base.Verify;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -445,9 +446,7 @@
this.stlLabel = params.stlLabel;
this.compilationMode = params.commonOptions.compilationMode;
this.useLLVMCoverageMap = params.commonOptions.useLLVMCoverageMapFormat;
- this.lipoContextCollector = cppOptions.lipoCollector;
-
-
+ this.lipoContextCollector = cppOptions.isLipoContextCollector();
this.crosstoolTopPathFragment = crosstoolTop.getPackageIdentifier().getPathUnderExecRoot();
try {
@@ -467,7 +466,7 @@
throw new AssertionError(e);
}
- if (cppOptions.lipoMode == LipoMode.BINARY) {
+ if (cppOptions.getLipoMode() == LipoMode.BINARY) {
// TODO(bazel-team): implement dynamic linking with LIPO
this.dynamicMode = DynamicMode.OFF;
} else {
@@ -1685,7 +1684,7 @@
* AutoFDO mode.
*/
public boolean getAutoFdoLipoData() {
- return cppOptions.autoFdoLipoData;
+ return cppOptions.getAutoFdoLipoData();
}
/**
@@ -1700,18 +1699,31 @@
* Returns the currently active LIPO compilation mode.
*/
public LipoMode getLipoMode() {
- return cppOptions.lipoMode;
+ return cppOptions.getLipoMode();
}
public boolean isFdo() {
return cppOptions.isFdo();
}
+ /**
+ * Returns true if LIPO optimization should be applied for this configuration.
+ */
public boolean isLipoOptimization() {
// The LIPO optimization bits are set in the LIPO context collector configuration, too.
return cppOptions.isLipoOptimization();
}
+ /**
+ * Returns true if this is a data configuration for a LIPO-optimizing build.
+ *
+ * <p>This means LIPO is not applied for this configuration, but LIPO might be reenabled further
+ * down the dependency tree.
+ */
+ public boolean isDataConfigurationForLipoOptimization() {
+ return cppOptions.isDataConfigurationForLipoOptimization();
+ }
+
public boolean isLipoOptimizationOrInstrumentation() {
return cppOptions.isLipoOptimizationOrInstrumentation();
}
@@ -1720,8 +1732,8 @@
* Returns true if it is AutoFDO LIPO build.
*/
public boolean isAutoFdoLipo() {
- return cppOptions.fdoOptimize != null
- && CppFileTypes.GCC_AUTO_PROFILE.matches(cppOptions.fdoOptimize)
+ return cppOptions.getFdoOptimize() != null
+ && CppFileTypes.GCC_AUTO_PROFILE.matches(cppOptions.getFdoOptimize())
&& getLipoMode() != LipoMode.OFF;
}
@@ -1755,8 +1767,29 @@
return ImmutableList.copyOf(cppOptions.perFileCopts);
}
+ /**
+ * Returns the LIPO context for this configuration.
+ *
+ * <p>This only exists for configurations that apply LIPO in LIPO-optimized builds. It does
+ * <b>not</b> exist for data configurations, which contain LIPO state but don't actually apply
+ * LIPO. Nor does it exist for host configurations, which contain no LIPO state.
+ */
public Label getLipoContextLabel() {
- return cppOptions.getLipoContextLabel();
+ return cppOptions.getLipoContext();
+ }
+
+ /**
+ * Returns the LIPO context for this build, even if LIPO isn't enabled in the current
+ * configuration.
+ *
+ * <p>Unlike {@link #getLipoContextLabel}, this returns the LIPO context for the data
+ * configuration.
+ *
+ * <p>Unless you have a clear reason to use this version (which basically involves
+ * inspecting oher configurations' state), always use {@link #getLipoContextLabel}.
+ */
+ public Label getLipoContextForBuild() {
+ return cppOptions.getLipoContextForBuild();
}
/**
@@ -2038,23 +2071,23 @@
}
}
- if (cppOptions.fdoInstrument != null && cppOptions.fdoOptimize != null) {
+ if (cppOptions.getFdoInstrument() != null && cppOptions.getFdoOptimize() != null) {
reporter.handle(Event.error("Cannot instrument and optimize for FDO at the same time. "
+ "Remove one of the '--fdo_instrument' and '--fdo_optimize' options"));
}
- if (cppOptions.lipoContext != null) {
- if (cppOptions.lipoMode != LipoMode.BINARY || cppOptions.fdoOptimize == null) {
+ if (cppOptions.lipoContextForBuild != null) {
+ if (cppOptions.getLipoMode() != LipoMode.BINARY || cppOptions.getFdoOptimize() == null) {
reporter.handle(Event.warn("The --lipo_context option can only be used together with "
+ "--fdo_optimize=<profile zip> and --lipo=binary. LIPO context will be ignored."));
}
} else {
- if (cppOptions.lipoMode == LipoMode.BINARY && cppOptions.fdoOptimize != null) {
+ if (cppOptions.getLipoMode() == LipoMode.BINARY && cppOptions.getFdoOptimize() != null) {
reporter.handle(Event.error("The --lipo_context option must be specified when using "
+ "--fdo_optimize=<profile zip> and --lipo=binary"));
}
}
- if (cppOptions.lipoMode == LipoMode.BINARY && compilationMode != CompilationMode.OPT) {
+ if (cppOptions.getLipoMode() == LipoMode.BINARY && compilationMode != CompilationMode.OPT) {
reporter.handle(Event.error(
"'--lipo=binary' can only be used with '--compilation_mode=opt' (or '-c opt')"));
}
@@ -2070,6 +2103,11 @@
+ "generate a dwp for the test executable, use '--fission=yes' with a toolchain "
+ "that supports Fission and build statically."));
}
+
+ // This is an assertion check vs. user error because users can't trigger this state.
+ Verify.verify(
+ !(buildOptions.get(BuildConfiguration.Options.class).isHost && cppOptions.isFdo()),
+ "FDO/LIPO state should not propagate to the host configuration");
}
@Override
@@ -2156,7 +2194,7 @@
}
public PathFragment getFdoInstrument() {
- return cppOptions.fdoInstrument;
+ return cppOptions.getFdoInstrument();
}
public Path getFdoZip() {
@@ -2170,7 +2208,7 @@
@Override
public ImmutableSet<String> configurationEnabledFeatures(RuleContext ruleContext) {
ImmutableSet.Builder<String> requestedFeatures = ImmutableSet.builder();
- if (cppOptions.fdoInstrument != null) {
+ if (cppOptions.getFdoInstrument() != null) {
requestedFeatures.add(CppRuleClasses.FDO_INSTRUMENT);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
index c6e4a81..4026cca 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
@@ -153,11 +153,11 @@
// FDO
// TODO(bazel-team): move this to CppConfiguration.prepareHook
Path fdoZip;
- if (cppOptions.fdoOptimize == null) {
+ if (cppOptions.getFdoOptimize() == null) {
fdoZip = null;
- } else if (cppOptions.fdoOptimize.startsWith("//")) {
+ } else if (cppOptions.getFdoOptimize().startsWith("//")) {
try {
- Target target = env.getTarget(Label.parseAbsolute(cppOptions.fdoOptimize));
+ Target target = env.getTarget(Label.parseAbsolute(cppOptions.getFdoOptimize()));
if (target == null) {
return null;
}
@@ -175,7 +175,7 @@
throw new InvalidConfigurationException(e);
}
} else {
- fdoZip = directories.getWorkspace().getRelative(cppOptions.fdoOptimize);
+ fdoZip = directories.getWorkspace().getRelative(cppOptions.getFdoOptimize());
try {
// We don't check for file existence, but at least the filename should be well-formed.
FileSystemUtils.checkBaseName(fdoZip.getBaseName());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index baa5bfe..1cd49e8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -33,12 +33,12 @@
import com.google.devtools.common.options.Converter;
import com.google.devtools.common.options.EnumConverter;
import com.google.devtools.common.options.Option;
-import com.google.devtools.common.options.OptionsParser.OptionUsageRestrictions;
import com.google.devtools.common.options.OptionsParsingException;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.annotation.Nullable;
/**
* Command-line options for C++.
@@ -128,14 +128,6 @@
}
@Option(
- name = "lipo input collector",
- defaultValue = "false",
- optionUsageRestrictions = OptionUsageRestrictions.INTERNAL,
- help = "Internal flag, only used to create configurations with the LIPO-collector flag set."
- )
- public boolean lipoCollector;
-
- @Option(
name = "crosstool_top",
defaultValue = "@bazel_tools//tools/cpp:toolchain",
category = "version",
@@ -380,7 +372,20 @@
+ "With Clang/LLVM compiler, it also accepts the directory name under"
+ "which the raw profile file(s) will be dumped at runtime."
)
- public PathFragment fdoInstrument;
+ /**
+ * Never read FDO/LIPO options directly. This is because {@link #lipoConfigurationState}
+ * determines whether these options are actually "active" for this configuration. Instead, use
+ * the equivalent getter method, which takes that into account.
+ */
+ public PathFragment fdoInstrumentForBuild;
+
+ /**
+ * Returns the --fdo_instrument value if FDO is specified and active for this configuration,
+ * the default value otherwise.
+ */
+ public PathFragment getFdoInstrument() {
+ return enableLipoSettings() ? fdoInstrumentForBuild : null;
+ }
@Option(
name = "fdo_optimize",
@@ -394,7 +399,20 @@
+ "need to add an exports_files directive to the corresponding package to make "
+ "the file visible to Blaze. It also accepts an indexed LLVM profile file."
)
- public String fdoOptimize;
+ /**
+ * Never read FDO/LIPO options directly. This is because {@link #lipoConfigurationState}
+ * determines whether these options are actually "active" for this configuration. Instead, use
+ * the equivalent getter method, which takes that into account.
+ */
+ public String fdoOptimizeForBuild;
+
+ /**
+ * Returns the --fdo_optimize value if FDO is specified and active for this configuration,
+ * the default value otherwise.
+ */
+ public String getFdoOptimize() {
+ return enableLipoSettings() ? fdoOptimizeForBuild : null;
+ }
@Option(
name = "autofdo_lipo_data",
@@ -404,8 +422,23 @@
"If true then the directory name for non-LIPO targets will have a "
+ "'-lipodata' suffix in AutoFDO mode."
)
- public boolean autoFdoLipoData;
+ /**
+ * Never read FDO/LIPO options directly. This is because {@link #lipoConfigurationState}
+ * determines whether these options are actually "active" for this configuration. Instead, use
+ * the equivalent getter method, which takes that into account.
+ */
+ public boolean autoFdoLipoDataForBuild;
+ /**
+ * Returns the --autofdo_lipo_data value for this configuration. This is false except for data
+ * configurations under LIPO builds.
+ */
+ public boolean getAutoFdoLipoData() {
+ return enableLipoSettings()
+ ? autoFdoLipoDataForBuild
+ : lipoModeForBuild != LipoMode.OFF && fdoOptimizeForBuild != null && FdoSupport.isAutoFdo(
+ fdoOptimizeForBuild);
+ }
@Option(
name = "lipo",
defaultValue = "off",
@@ -417,7 +450,20 @@
+ "only has an effect when FDO is also enabled. Currently LIPO is only supported "
+ "when building a single cc_binary rule."
)
- public LipoMode lipoMode;
+ /**
+ * Never read FDO/LIPO options directly. This is because {@link #lipoConfigurationState}
+ * determines whether these options are actually "active" for this configuration. Instead, use
+ * the equivalent getter method, which takes that into account.
+ */
+ public LipoMode lipoModeForBuild;
+
+ /**
+ * Returns the --lipo value if LIPO is specified and active for this configuration,
+ * the default value otherwise.
+ */
+ public LipoMode getLipoMode() {
+ return enableLipoSettings() ? lipoModeForBuild : LipoMode.OFF;
+ }
@Option(
name = "lipo_context",
@@ -427,7 +473,82 @@
implicitRequirements = {"--linkopt=-Wl,--warn-unresolved-symbols"},
help = "Specifies the binary from which the LIPO profile information comes."
)
- public Label lipoContext;
+ /**
+ * Never read FDO/LIPO options directly. This is because {@link #lipoConfigurationState}
+ * determines whether these options are actually "active" for this configuration. Instead, use
+ * the equivalent getter method, which takes that into account.
+ */
+ public Label lipoContextForBuild;
+
+ /**
+ * Returns the --lipo_context value if LIPO is specified and active for this configuration,
+ * null otherwise.
+ */
+ @Nullable
+ public Label getLipoContext() {
+ return isLipoOptimization() ? lipoContextForBuild : null;
+ }
+
+ /**
+ * Returns the LIPO context for this build, even if LIPO isn't enabled in the current
+ * configuration.
+ */
+ public Label getLipoContextForBuild() {
+ return lipoContextForBuild;
+ }
+
+ /**
+ * Internal state determining how to apply LIPO settings under this configuration.
+ */
+ public enum LipoConfigurationState {
+ /** Don't LIPO-optimize targets under this configuration. */
+ IGNORE_LIPO,
+ /** LIPO-optimize targets under this configuration if this is a LIPO build. */
+ APPLY_LIPO,
+ /**
+ * Evaluate targets in this configuration in "LIPO context collector" mode. See
+ * {@link FdoSupport} for details.
+ */
+ LIPO_CONTEXT_COLLECTOR,
+ }
+
+ /**
+ * Converter for {@link LipoConfigurationState}.
+ */
+ public static class LipoConfigurationStateConverter
+ extends EnumConverter<LipoConfigurationState> {
+ public LipoConfigurationStateConverter() {
+ super(LipoConfigurationState.class, "LIPO configuration state");
+ }
+ }
+
+ @Option(
+ name = "lipo configuration state",
+ defaultValue = "apply_lipo",
+ category = "internal",
+ converter = LipoConfigurationStateConverter.class
+ )
+ public LipoConfigurationState lipoConfigurationState;
+
+ /**
+ * Returns true if targets under this configuration should use the build's LIPO settings.
+ *
+ * <p>Even when we switch off LIPO (e.g. by switching to a data configuration), we still need to
+ * remember the LIPO settings in case we need to switch back (e.g. if we build a genrule with a
+ * data dependency on the LIPO context).
+ *
+ * <p>We achieve this by maintaining a "configuration state" flag that flips on / off when we
+ * want to enable / disable LIPO respectively. This means we need to be careful to distinguish
+ * between the existence of LIPO settings and LIPO actually applying to the configuration. So when
+ * buiding a target, it's not enough to see if {@link #lipoContextForBuild} or
+ * {@link #lipoModeForBuild} are set. We also need to check this flag.
+ *
+ * <p>This class exposes appropriate convenience methods to make these checks convenient and easy.
+ * Use them and read the documentation carefully.
+ */
+ private boolean enableLipoSettings() {
+ return lipoConfigurationState != LipoConfigurationState.IGNORE_LIPO;
+ }
@Option(
name = "experimental_stl",
@@ -636,8 +757,8 @@
host.useStartEndLib = useStartEndLib;
host.stripBinaries = StripMode.ALWAYS;
- host.fdoOptimize = null;
- host.lipoMode = LipoMode.OFF;
+ host.fdoOptimizeForBuild = null;
+ host.lipoModeForBuild = LipoMode.OFF;
host.inmemoryDotdFiles = inmemoryDotdFiles;
return host;
@@ -662,7 +783,7 @@
labelMap.put("crosstool", libcLabel);
}
}
- addOptionalLabel(labelMap, "fdo", fdoOptimize);
+ addOptionalLabel(labelMap, "fdo", getFdoOptimize());
if (stl != null) {
labelMap.put("STL", stl);
@@ -672,8 +793,8 @@
labelMap.put("custom_malloc", customMalloc);
}
- if (getLipoContextLabel() != null) {
- labelMap.put("lipo", getLipoContextLabel());
+ if (getLipoContext() != null) {
+ labelMap.put("lipo", getLipoContext());
}
}
@@ -695,29 +816,53 @@
return ImmutableMap.of("CROSSTOOL", crosstoolLabels, "COVERAGE", ImmutableSet.<Label>of());
}
+ /**
+ * Returns true if targets under this configuration should apply FDO.
+ */
public boolean isFdo() {
- return fdoOptimize != null || fdoInstrument != null;
+ return getFdoOptimize() != null || getFdoInstrument() != null;
}
+ /**
+ * Returns true if this configuration has LIPO optimization settings (even if they're
+ * not necessarily active).
+ */
+ private boolean hasLipoOptimizationState() {
+ return lipoModeForBuild == LipoMode.BINARY && fdoOptimizeForBuild != null
+ && lipoContextForBuild != null;
+ }
+
+ /**
+ * Returns true if targets under this configuration should LIPO-optimize.
+ */
public boolean isLipoOptimization() {
- return lipoMode == LipoMode.BINARY
- && fdoOptimize != null
- && lipoContext != null
- && !lipoCollector;
+ return hasLipoOptimizationState() && enableLipoSettings() && !isLipoContextCollector();
}
+ /**
+ * Returns true if this is a data configuration for a LIPO-optimizing build.
+ *
+ * <p>This means LIPO is not applied for this configuration, but LIPO might be reenabled further
+ * down the dependency tree.
+ */
+ public boolean isDataConfigurationForLipoOptimization() {
+ return hasLipoOptimizationState() && !enableLipoSettings();
+ }
+
+ /**
+ * Returns true if targets under this configuration should LIPO-optimize or LIPO-instrument.
+ */
public boolean isLipoOptimizationOrInstrumentation() {
- return lipoMode == LipoMode.BINARY
- && ((fdoOptimize != null && lipoContext != null) || fdoInstrument != null)
- && !lipoCollector;
+ return getLipoMode() == LipoMode.BINARY
+ && ((getFdoOptimize() != null && getLipoContext() != null) || getFdoInstrument() != null)
+ && !isLipoContextCollector();
}
- public Label getLipoContextLabel() {
- return (lipoMode == LipoMode.BINARY && fdoOptimize != null) ? lipoContext : null;
- }
-
- public LipoMode getLipoMode() {
- return lipoMode;
+ /**
+ * Returns true if this is the LIPO context collector configuration.
+ */
+ public boolean isLipoContextCollector() {
+ return lipoConfigurationState == LipoConfigurationState.LIPO_CONTEXT_COLLECTOR;
}
/**
@@ -726,7 +871,7 @@
@Override
public boolean useStaticConfigurationsOverride() {
// --lipo=binary is technically possible without FDO, even though it doesn't do anything.
- return isFdo() || getLipoMode() == LipoMode.BINARY;
+ return isFdo() || lipoModeForBuild == LipoMode.BINARY;
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/transitions/LipoDataTransition.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/transitions/LipoDataTransition.java
index 3556eec..d9b9ae0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/transitions/LipoDataTransition.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/transitions/LipoDataTransition.java
@@ -44,7 +44,7 @@
}
CppOptions cppOptions = options.get(CppOptions.class);
- if (cppOptions.lipoMode == CrosstoolConfig.LipoMode.OFF) {
+ if (cppOptions.getLipoMode() == CrosstoolConfig.LipoMode.OFF) {
return options;
}
@@ -52,12 +52,12 @@
cppOptions = options.get(CppOptions.class);
// Once autoFdoLipoData is on, it stays on (through all future transitions).
- if (!cppOptions.autoFdoLipoData && cppOptions.fdoOptimize != null) {
- cppOptions.autoFdoLipoData = FdoSupport.isAutoFdo(cppOptions.fdoOptimize);
+ if (!cppOptions.getAutoFdoLipoData() && cppOptions.getFdoOptimize() != null) {
+ cppOptions.autoFdoLipoDataForBuild = FdoSupport.isAutoFdo(cppOptions.getFdoOptimize());
}
- cppOptions.lipoMode = CrosstoolConfig.LipoMode.OFF;
- cppOptions.fdoInstrument = null;
- cppOptions.fdoOptimize = null;
+ cppOptions.lipoModeForBuild = CrosstoolConfig.LipoMode.OFF;
+ cppOptions.fdoInstrumentForBuild = null;
+ cppOptions.fdoOptimizeForBuild = null;
return options;
}