Skip to content

Commit

Permalink
Revert "[BOLT] Fix unconditional output of boltedcollection in merge-…
Browse files Browse the repository at this point in the history
…fdata (#78653)"

This reverts commit 82bc33e.

Accidentally pushed unrelated changes.
  • Loading branch information
aaupov committed Jan 19, 2024
1 parent 82bc33e commit 9fec33a
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 452 deletions.
1 change: 0 additions & 1 deletion bolt/lib/Core/BinaryEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, FunctionFragment &FF,
// This assumes the second instruction in the macro-op pair will get
// assigned to its own MCRelaxableFragment. Since all JCC instructions
// are relaxable, we should be safe.
Streamer.emitNeverAlignCodeAtEnd(/*Alignment to avoid=*/64, *BC.STI);
}

if (!EmitCodeOnly) {
Expand Down
3 changes: 2 additions & 1 deletion bolt/test/X86/merge-fdata-bat-mode.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ RUN: merge-fdata %S/Inputs/bat_profile_1.fdata \
RUN: %S/Inputs/bat_profile_2.fdata \
RUN: | FileCheck %s --check-prefix=CHECK-FDATA

CHECK-FDATA: boltedcollection
CHECK-FDATA: 1 main 451 1 SolveCubic 0 0 302


6 changes: 0 additions & 6 deletions bolt/test/X86/merge-fdata-nobat-mode.test

This file was deleted.

2 changes: 1 addition & 1 deletion bolt/tools/merge-fdata/merge-fdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void mergeLegacyProfiles(const SmallVectorImpl<std::string> &Filenames) {
MergedProfile.insert_or_assign(Key, Count);
}

if (BoltedCollection.value_or(false))
if (BoltedCollection)
output() << "boltedcollection\n";
for (const auto &[Key, Value] : MergedProfile)
output() << Key << " " << Value << "\n";
Expand Down
4 changes: 0 additions & 4 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -5256,10 +5256,6 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">,
MarshallingInfoFlag<CodeGenOpts<"InstrumentForProfiling">>;
def pipe : Flag<["-", "--"], "pipe">,
HelpText<"Use pipes between commands, when possible">;
// Facebook T92898286
def post_link_optimize : Flag<["--"], "post-link-optimize">,
HelpText<"Apply post-link optimizations using BOLT">;
// End Facebook T92898286
def prebind__all__twolevel__modules : Flag<["-"], "prebind_all_twolevel_modules">;
def prebind : Flag<["-"], "prebind">;
def preload : Flag<["-"], "preload">;
Expand Down
29 changes: 0 additions & 29 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,41 +668,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
}

// Facebook T92898286
if (Args.hasArg(options::OPT_post_link_optimize))
CmdArgs.push_back("-q");
// End Facebook T92898286

Args.AddAllArgs(CmdArgs, options::OPT_T);

const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
C.addCommand(std::make_unique<Command>(JA, *this,
ResponseFileSupport::AtFileCurCP(),
Exec, CmdArgs, Inputs, Output));
// Facebook T92898286
if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename())
return;

const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv"));
ArgStringList MoveCmdArgs;
MoveCmdArgs.push_back(Output.getFilename());
const char *PreBoltBin =
Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt");
MoveCmdArgs.push_back(PreBoltBin);
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
MvExec, MoveCmdArgs, std::nullopt));

ArgStringList BoltCmdArgs;
const char *BoltExec =
Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt"));
BoltCmdArgs.push_back(PreBoltBin);
BoltCmdArgs.push_back("-reorder-blocks=reverse");
BoltCmdArgs.push_back("-update-debug-sections");
BoltCmdArgs.push_back("-o");
BoltCmdArgs.push_back(Output.getFilename());
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
BoltExec, BoltCmdArgs, std::nullopt));
// End Facebook T92898286
}

void tools::gnutools::Assembler::ConstructJob(Compilation &C,
Expand Down
14 changes: 1 addition & 13 deletions cross-project-tests/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ def get_required_attr(config, attr_name):
# use_clang() and use_lld() respectively, so set them to "", if needed.
if not hasattr(config, "clang_src_dir"):
config.clang_src_dir = ""
# Facebook T92898286
should_test_bolt = get_required_attr(config, "llvm_test_bolt")
if should_test_bolt:
llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects), additional_flags=["--post-link-optimize"])
else:
llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects))
# End Facebook T92898286
llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects))

if not hasattr(config, "lld_src_dir"):
config.lld_src_dir = ""
Expand Down Expand Up @@ -299,9 +293,3 @@ def get_clang_default_dwarf_version_string(triple):
# Allow 'REQUIRES: XXX-registered-target' in tests.
for arch in config.targets_to_build:
config.available_features.add(arch.lower() + "-registered-target")

# Facebook T92898286
# Ensure the user's PYTHONPATH is included.
if "PYTHONPATH" in os.environ:
config.environment["PYTHONPATH"] = os.environ["PYTHONPATH"]
# End Facebook T92898286
4 changes: 0 additions & 4 deletions cross-project-tests/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ config.mlir_src_root = "@MLIR_SOURCE_DIR@"

config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"

# Facebook T92898286
config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@")
# End Facebook T92898286

import lit.llvm
lit.llvm.initialize(lit_config, config)

Expand Down
5 changes: 0 additions & 5 deletions lldb/test/API/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ def delete_module_cache(path):
if is_configured("lldb_framework_dir"):
dotest_cmd += ["--framework", config.lldb_framework_dir]

# Facebook T92898286
if is_configured("llvm_test_bolt"):
dotest_cmd += ["-E", '"--post-link-optimize"']
# End Facebook T92898286

if (
"lldb-repro-capture" in config.available_features
or "lldb-repro-replay" in config.available_features
Expand Down
8 changes: 0 additions & 8 deletions lldb/test/API/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
@LIT_SITE_CFG_IN_HEADER@

#Facebook T92898286
import lit.util
#End Facebook T92898286

config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
Expand Down Expand Up @@ -43,10 +39,6 @@ config.libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")

# Facebook T92898286
config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@")
# End Facebook T92898286

# Plugins
lldb_build_intel_pt = '@LLDB_BUILD_INTEL_PT@'
if lldb_build_intel_pt == '1':
Expand Down
5 changes: 0 additions & 5 deletions lldb/test/Shell/helper/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ def use_support_substitutions(config):
if config.cmake_sysroot:
host_flags += ["--sysroot={}".format(config.cmake_sysroot)]

# Facebook T92898286
if config.llvm_test_bolt:
host_flags += ["--post-link-optimize"]
# End Facebook T92898286

host_flags = " ".join(host_flags)
config.substitutions.append(("%clang_host", "%clang " + host_flags))
config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags))
Expand Down
9 changes: 0 additions & 9 deletions lldb/test/Shell/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
@LIT_SITE_CFG_IN_HEADER@

#Facebook T92898286
import lit.util
#End Facebook T92898286


config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
Expand Down Expand Up @@ -35,10 +30,6 @@ config.lldb_system_debugserver = @LLDB_USE_SYSTEM_DEBUGSERVER@
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell")

# Facebook T92898286
config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@")
# End Facebook T92898286

import lit.llvm
lit.llvm.initialize(lit_config, config)

Expand Down
4 changes: 0 additions & 4 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,6 @@ set(LLVM_LIB_FUZZING_ENGINE "" CACHE PATH
option(LLVM_USE_SPLIT_DWARF
"Use -gsplit-dwarf when compiling llvm and --gdb-index when linking." OFF)

# Facebook T92898286
option(LLVM_TEST_BOLT "Enable BOLT testing in non-BOLT tests that use clang" OFF)
# End Facebook T92898286

# Define an option controlling whether we should build for 32-bit on 64-bit
# platforms, where supported.
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
Expand Down
22 changes: 0 additions & 22 deletions llvm/include/llvm/MC/MCFragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class MCFragment : public ilist_node_with_parent<MCFragment, MCSection> {
public:
enum FragmentType : uint8_t {
FT_Align,
FT_NeverAlign,
FT_Data,
FT_CompactEncodedInst,
FT_Fill,
Expand Down Expand Up @@ -345,27 +344,6 @@ class MCAlignFragment : public MCFragment {
}
};

class MCNeverAlignFragment : public MCFragment {
/// The alignment the end of the next fragment should avoid.
unsigned Alignment;

/// When emitting Nops some subtargets have specific nop encodings.
const MCSubtargetInfo &STI;

public:
MCNeverAlignFragment(unsigned Alignment, const MCSubtargetInfo &STI,
MCSection *Sec = nullptr)
: MCFragment(FT_NeverAlign, false, Sec), Alignment(Alignment), STI(STI) {}

unsigned getAlignment() const { return Alignment; }

const MCSubtargetInfo &getSubtargetInfo() const { return STI; }

static bool classof(const MCFragment *F) {
return F->getKind() == MCFragment::FT_NeverAlign;
}
};

class MCFillFragment : public MCFragment {
uint8_t ValueSize;
/// Value to use for filling bytes.
Expand Down
2 changes: 0 additions & 2 deletions llvm/include/llvm/MC/MCObjectStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ class MCObjectStreamer : public MCStreamer {
unsigned MaxBytesToEmit = 0) override;
void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI,
unsigned MaxBytesToEmit = 0) override;
void emitNeverAlignCodeAtEnd(unsigned ByteAlignment,
const MCSubtargetInfo &STI) override;
void emitValueToOffset(const MCExpr *Offset, unsigned char Value,
SMLoc Loc) override;
void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column,
Expand Down
6 changes: 0 additions & 6 deletions llvm/include/llvm/MC/MCStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,6 @@ class MCStreamer {
virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,
unsigned MaxBytesToEmit = 0);

/// If the end of the fragment following this NeverAlign fragment ever gets
/// aligned to \p ByteAlignment, this fragment emits a single nop before the
/// following fragment to break this end-alignment.
virtual void emitNeverAlignCodeAtEnd(unsigned ByteAlignment,
const MCSubtargetInfo &STI);

/// Emit some number of copies of \p Value until the byte offset \p
/// Offset is reached.
///
Expand Down

0 comments on commit 9fec33a

Please sign in to comment.