aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-06-22 03:55:40 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-06-22 12:47:38 +0200
commit34bbdb0666cb2b1b97279161250534d312c71454 (patch)
tree8f494937cec5626a1a7e3f56ff2f0c03563953e2
parent3c566c6697a3a0e574f0cc7da2da9fb16be35cb7 (diff)
Fix LIPO to ThinLTO mapping to work with AutoFDO.
LIPO to ThinLTO mapping was added in https://github.com/bazelbuild/bazel/commit/c61f86f56b86e442369725ad79299ccc5519b000. This fixes a bug to ignore lipo context when compiler is LLVM. RELNOTES:None PiperOrigin-RevId: 159776286
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
index 472daf4635..03f1b0a377 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
@@ -572,16 +572,14 @@ public class FdoSupport {
private Iterable<Artifact> getAuxiliaryInputs(
RuleContext ruleContext, PathFragment sourceName, PathFragment sourceExecPath, boolean usePic,
FdoSupportProvider fdoSupportProvider) {
- LipoContextProvider lipoContextProvider = CppHelper.getLipoContextProvider(ruleContext);
+ CppConfiguration cppConfig = ruleContext.getFragment(CppConfiguration.class);
+ LipoContextProvider lipoContextProvider =
+ cppConfig.isLLVMCompiler() ? null : CppHelper.getLipoContextProvider(ruleContext);
// If --fdo_optimize was not specified, we don't have any additional inputs.
if (fdoProfile == null) {
return ImmutableSet.of();
- } else if (fdoMode == FdoMode.LLVM_FDO) {
- ImmutableSet.Builder<Artifact> auxiliaryInputs = ImmutableSet.builder();
- auxiliaryInputs.add(fdoSupportProvider.getProfileArtifact());
- return auxiliaryInputs.build();
- } else if (fdoMode == FdoMode.AUTO_FDO) {
+ } else if (fdoMode == FdoMode.LLVM_FDO || fdoMode == FdoMode.AUTO_FDO) {
ImmutableSet.Builder<Artifact> auxiliaryInputs = ImmutableSet.builder();
auxiliaryInputs.add(fdoSupportProvider.getProfileArtifact());
if (lipoContextProvider != null) {