aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-07-16 08:16:00 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-07-17 13:16:48 +0000
commitb961bb931400044ed91e6b0b596f94fe983f9f17 (patch)
tree11ac5264e4b36e9a362b11fe0c80cbaafe78f275 /src/main/java/com/google/devtools
parente8946a75103d60e340f9f52022726ce5b3f5b902 (diff)
*** Reason for rollback *** Breaks LIPO, [] *** Original change description *** Blaze changes to support LLVM profile feedback. -- MOS_MIGRATED_REVID=98382087
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java9
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java44
4 files changed, 11 insertions, 51 deletions
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 06c9e6b9cc..f6ee5848a8 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
@@ -726,8 +726,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
+ " action: 'c++-compile'"
+ " action: 'c++-link'"
+ " flag_group {"
- + " flag: '-Xgcc-only=-fprofile-generate=%{fdo_instrument_path}'"
- + " flag: '-Xclang-only=-fprofile-instr-generate=%{fdo_instrument_path}'"
+ + " flag: '-fprofile-generate=%{fdo_instrument_path}'"
+ " }"
+ " flag_group {"
+ " flag: '-fno-data-sections'"
@@ -744,10 +743,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
+ " action: 'c-compile'"
+ " action: 'c++-compile'"
+ " flag_group {"
- + " flag: '-Xgcc-only=-fprofile-use=%{fdo_profile_path}'"
- + " flag: '-Xclang-only=-fprofile-instr-use=%{fdo_profile_path}'"
- + " flag: '-Xclang-only=-Wno-profile-instr-unprofiled'"
- + " flag: '-Xclang-only=-Wno-profile-instr-out-of-date'"
+ + " flag: '-fprofile-use=%{fdo_profile_path}'"
+ " flag: '-fprofile-correction'"
+ " }"
+ " }"
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
index a1a371b8de..0d19b9ab42 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
@@ -132,7 +132,6 @@ public final class CppFileTypes {
public static final FileType COVERAGE_DATA = FileType.of(".gcda");
public static final FileType COVERAGE_DATA_IMPORTS = FileType.of(".gcda.imports");
public static final FileType GCC_AUTO_PROFILE = FileType.of(".afdo");
- public static final FileType LLVM_PROFILE = FileType.of(".profdata");
public static final FileType CPP_MODULE_MAP = FileType.of(".cppmap");
public static final FileType CPP_MODULE = FileType.of(".pcm");
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 7915bb2916..02a6eb91a1 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
@@ -192,8 +192,8 @@ public class CppOptions extends FragmentOptions {
@Option(name = "thin_archives",
defaultValue = "false",
category = "strategy", // but also adds edges to the action graph
- help = "Pass the 'T' flag to ar if supported by the toolchain. "
- + "All supported toolchains support this setting.")
+ help = "Pass the 'T' flag to ar if supported by the toolchain. " +
+ "All supported toolchains support this setting.")
public boolean useThinArchives;
// O intrepid reaper of unused options: Be warned that the [no]start_end_lib
@@ -353,8 +353,7 @@ public class CppOptions extends FragmentOptions {
category = "flags",
implicitRequirements = {"--copt=-Wno-error"},
help = "Generate binaries with FDO instrumentation. Specify the relative " +
- "directory name for the .gcda files at runtime. It also accepts " +
- "an LLVM profile output file path.")
+ "directory name for the .gcda files at runtime.")
public PathFragment fdoInstrument;
@Option(name = "fdo_optimize",
@@ -365,7 +364,7 @@ public class CppOptions extends FragmentOptions {
"an auto profile. This flag also accepts files specified as labels, for " +
"example //foo/bar:file.afdo. Such labels must refer to input files; you may " +
"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.")
+ "the file visible to Blaze.")
public String fdoOptimize;
@Option(name = "autofdo_lipo_data",
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 a2339c2b2a..592fe2c295 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
@@ -121,20 +121,13 @@ public class FdoSupport {
private static final PathFragment ZIP_ROOT = new PathFragment("/");
/**
- * Returns true if the given fdoFile represents an AutoFdo profile.
+ * Returns true if the give fdoFile represents an AutoFdo profile.
*/
public static final boolean isAutoFdo(String fdoFile) {
return CppFileTypes.GCC_AUTO_PROFILE.matches(fdoFile);
}
/**
- * Returns true if the given fdoFile represents an LLVM profile.
- */
- public static final boolean isLLVMFdo(String fdoFile) {
- return CppFileTypes.LLVM_PROFILE.matches(fdoFile);
- }
-
- /**
* Coverage information output directory passed to {@code --fdo_instrument},
* or {@code null} if FDO instrumentation is disabled.
*/
@@ -180,12 +173,6 @@ public class FdoSupport {
private final boolean useAutoFdo;
/**
- * Flag indicating whether to use LLVM instrumentation-based FDO (as
- * opposed to GCC instrumentation-based FDO).
- */
- private final boolean useLLVMFdo;
-
- /**
* The {@code .gcda} files that have been extracted from the ZIP file,
* relative to the root of the ZIP file.
*
@@ -230,7 +217,6 @@ public class FdoSupport {
fdoProfile.getBaseName()));
this.lipoMode = lipoMode;
this.useAutoFdo = fdoProfile != null && isAutoFdo(fdoProfile.getBaseName());
- this.useLLVMFdo = fdoProfile != null && isLLVMFdo(fdoProfile.getBaseName());
}
public Root getFdoRoot() {
@@ -290,9 +276,6 @@ public class FdoSupport {
}
FileSystemUtils.ensureSymbolicLink(
execRoot.getRelative(getAutoProfilePath()), fdoProfile);
- } else if (useLLVMFdo) {
- FileSystemUtils.ensureSymbolicLink(
- execRoot.getRelative(getLLVMProfilePath()), fdoProfile);
} else {
Path zipFilePath = new ZipFileSystem(fdoProfile).getRootDirectory();
if (!zipFilePath.getRelative("blaze-out").isDirectory()) {
@@ -494,13 +477,8 @@ public class FdoSupport {
getAutoProfilePath().getPathString());
}
if (featureConfiguration.isEnabled(CppRuleClasses.FDO_OPTIMIZE)) {
- if (useLLVMFdo) {
- buildVariables.addVariable("fdo_profile_path",
- getLLVMProfilePath().getPathString());
- } else {
- buildVariables.addVariable("fdo_profile_path",
- fdoRootExecPath.getPathString());
- }
+ buildVariables.addVariable("fdo_profile_path",
+ fdoRootExecPath.getPathString());
}
} else {
// TODO(bazel-team): Remove this workaround once the feature configuration
@@ -538,14 +516,11 @@ public class FdoSupport {
// If --fdo_optimize was not specified, we don't have any additional inputs.
if (fdoProfile == null) {
return ImmutableSet.of();
- } else if (useAutoFdo || useLLVMFdo) {
+ } else if (useAutoFdo) {
ImmutableSet.Builder<Artifact> auxiliaryInputs = ImmutableSet.builder();
- PathFragment profileRootRelativePath = (useLLVMFdo)
- ? getLLVMProfileRootRelativePath()
- : getAutoProfileRootRelativePath();
Artifact artifact = env.getDerivedArtifact(
- fdoPath.getRelative(profileRootRelativePath), fdoRoot);
+ fdoPath.getRelative(getAutoProfileRootRelativePath()), fdoRoot);
env.registerAction(new FdoStubAction(ruleContext.getActionOwner(), artifact));
auxiliaryInputs.add(artifact);
if (lipoContextProvider != null) {
@@ -649,15 +624,6 @@ public class FdoSupport {
return new PathFragment(fdoProfile.getBaseName());
}
-
- private PathFragment getLLVMProfilePath() {
- return fdoRootExecPath.getRelative(getLLVMProfileRootRelativePath());
- }
-
- private PathFragment getLLVMProfileRootRelativePath() {
- return new PathFragment(fdoProfile.getBaseName());
- }
-
/**
* Returns whether LIPO is enabled.
*/