diff options
author | Jessica Paquette <jpaquette@apple.com> | 2018-04-19 22:17:07 +0000 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2018-04-19 22:17:07 +0000 |
commit | 1eca23bdd88e9357477d198f6dd922e1fcba9d77 (patch) | |
tree | dfbf4166e435526b150aec4297154098642fdcc9 /llvm | |
parent | 6a2a5e0abb3ef6d7acf93f2c2a070db0a5a4c22e (diff) | |
download | bcm5719-llvm-1eca23bdd88e9357477d198f6dd922e1fcba9d77.tar.gz bcm5719-llvm-1eca23bdd88e9357477d198f6dd922e1fcba9d77.zip |
[MachineOutliner] NFC: Move EnableLinkOnceODROutlining into MachineOutliner.cpp
This moves the EnableLinkOnceODROutlining flag from TargetPassConfig.cpp into
MachineOutliner.cpp. It also removes OutlineFromLinkOnceODRs from the
MachineOutliner constructor. This is now handled by the moved command-line
flag.
llvm-svn: 330373
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/CodeGen/Passes.h | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 23 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 7 |
3 files changed, 21 insertions, 11 deletions
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 68fd04b292e..fac7b8c7172 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -419,7 +419,7 @@ namespace llvm { /// This pass performs outlining on machine instructions directly before /// printing assembly. - ModulePass *createMachineOutlinerPass(bool OutlineFromLinkOnceODRs = false); + ModulePass *createMachineOutlinerPass(); /// This pass expands the experimental reduction intrinsics into sequences of /// shuffles. diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 932316f1fd1..d56f113aa7f 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -71,6 +71,7 @@ #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Mangler.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include <functional> @@ -87,6 +88,17 @@ using namespace ore; STATISTIC(NumOutlined, "Number of candidates outlined"); STATISTIC(FunctionsCreated, "Number of functions created"); +// Set to true if the user wants the outliner to run on linkonceodr linkage +// functions. This is false by default because the linker can dedupe linkonceodr +// functions. Since the outliner is confined to a single module (modulo LTO), +// this is off by default. It should, however, be the default behaviour in +// LTO. +static cl::opt<bool> EnableLinkOnceODROutlining( + "enable-linkonceodr-outlining", + cl::Hidden, + cl::desc("Enable the machine outliner on linkonceodr functions"), + cl::init(false)); + namespace { /// \brief An individual sequence of instructions to be replaced with a call to @@ -813,8 +825,7 @@ struct MachineOutliner : public ModulePass { ModulePass::getAnalysisUsage(AU); } - MachineOutliner(bool OutlineFromLinkOnceODRs = false) - : ModulePass(ID), OutlineFromLinkOnceODRs(OutlineFromLinkOnceODRs) { + MachineOutliner() : ModulePass(ID) { initializeMachineOutlinerPass(*PassRegistry::getPassRegistry()); } @@ -910,8 +921,8 @@ struct MachineOutliner : public ModulePass { char MachineOutliner::ID = 0; namespace llvm { -ModulePass *createMachineOutlinerPass(bool OutlineFromLinkOnceODRs) { - return new MachineOutliner(OutlineFromLinkOnceODRs); +ModulePass *createMachineOutlinerPass() { + return new MachineOutliner(); } } // namespace llvm @@ -1425,6 +1436,10 @@ bool MachineOutliner::runOnModule(Module &M) { return false; } + // If the user specifies that they want to outline from linkonceodrs, set + // it here. + OutlineFromLinkOnceODRs = EnableLinkOnceODROutlining; + InstructionMapper Mapper; // Build instruction mappings for each function in the module. Start by diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 04301723c08..46152aa09e8 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -114,11 +114,6 @@ static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden, static cl::opt<bool> EnableMachineOutliner("enable-machine-outliner", cl::Hidden, cl::desc("Enable machine outliner")); -static cl::opt<bool> EnableLinkOnceODROutlining( - "enable-linkonceodr-outlining", - cl::Hidden, - cl::desc("Enable the machine outliner on linkonceodr functions"), - cl::init(false)); // Enable or disable FastISel. Both options are needed, because // FastISel is enabled by default with -fast, and we wish to be // able to enable or disable fast-isel independently from -O0. @@ -907,7 +902,7 @@ void TargetPassConfig::addMachinePasses() { addPass(&PatchableFunctionID, false); if (EnableMachineOutliner) - PM->add(createMachineOutlinerPass(EnableLinkOnceODROutlining)); + addPass(createMachineOutlinerPass()); // Add passes that directly emit MI after all other MI passes. addPreEmitPass2(); |