LLVM
12.0.0git
|
#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/TypeMetadataUtils.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndexYAML.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GlobPattern.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/Transforms/Utils/Evaluator.h"
#include <algorithm>
#include <cstddef>
#include <map>
#include <set>
#include <string>
Go to the source code of this file.
Classes | |
struct | llvm::DenseMapInfo< VTableSlot > |
struct | llvm::DenseMapInfo< VTableSlotSummary > |
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
Macros | |
#define | DEBUG_TYPE "wholeprogramdevirt" |
Functions | |
INITIALIZE_PASS_BEGIN (WholeProgramDevirt, "wholeprogramdevirt", "Whole program devirtualization", false, false) INITIALIZE_PASS_END(WholeProgramDevirt | |
static bool | hasWholeProgramVisibility (bool WholeProgramVisibilityEnabledInLTO) |
void | llvm::updateVCallVisibilityInModule (Module &M, bool WholeProgramVisibilityEnabledInLTO) |
If whole program visibility asserted, then upgrade all public vcall visibility metadata on vtable definitions to linkage unit visibility in Module IR (for regular or hybrid LTO). More... | |
void | llvm::updateVCallVisibilityInIndex (ModuleSummaryIndex &Index, bool WholeProgramVisibilityEnabledInLTO) |
If whole program visibility asserted, then upgrade all public vcall visibility metadata on vtable definition summaries to linkage unit visibility in Module summary index (for ThinLTO). More... | |
void | llvm::runWholeProgramDevirtOnIndex (ModuleSummaryIndex &Summary, std::set< GlobalValue::GUID > &ExportedGUIDs, std::map< ValueInfo, std::vector< VTableSlotSummary >> &LocalWPDTargetsMap) |
Perform index-based whole program devirtualization on the Summary index. More... | |
void | llvm::updateIndexWPDForExports (ModuleSummaryIndex &Summary, function_ref< bool(StringRef, ValueInfo)> isExported, std::map< ValueInfo, std::vector< VTableSlotSummary >> &LocalWPDTargetsMap) |
Call after cross-module importing to update the recorded single impl devirt target names for any locals that were exported. More... | |
static Error | checkCombinedSummaryForTesting (ModuleSummaryIndex *Summary) |
static bool | AddCalls (VTableSlotInfo &SlotInfo, const ValueInfo &Callee) |
Variables | |
static cl::opt< PassSummaryAction > | ClSummaryAction ("wholeprogramdevirt-summary-action", cl::desc("What to do with the summary when running this pass"), cl::values(clEnumValN(PassSummaryAction::None, "none", "Do nothing"), clEnumValN(PassSummaryAction::Import, "import", "Import typeid resolutions from summary and globals"), clEnumValN(PassSummaryAction::Export, "export", "Export typeid resolutions to summary and globals")), cl::Hidden) |
static cl::opt< std::string > | ClReadSummary ("wholeprogramdevirt-read-summary", cl::desc("Read summary from given bitcode or YAML file before running pass"), cl::Hidden) |
static cl::opt< std::string > | ClWriteSummary ("wholeprogramdevirt-write-summary", cl::desc("Write summary to given bitcode or YAML file after running pass. " "Output file format is deduced from extension: *.bc means writing " "bitcode, otherwise YAML"), cl::Hidden) |
static cl::opt< unsigned > | ClThreshold ("wholeprogramdevirt-branch-funnel-threshold", cl::Hidden, cl::init(10), cl::ZeroOrMore, cl::desc("Maximum number of call targets per " "call site to enable branch funnels")) |
static cl::opt< bool > | PrintSummaryDevirt ("wholeprogramdevirt-print-index-based", cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::desc("Print index-based devirtualization messages")) |
cl::opt< bool > | WholeProgramVisibility ("whole-program-visibility", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Enable whole program visibility")) |
Provide a way to force enable whole program visibility in tests. More... | |
cl::opt< bool > | DisableWholeProgramVisibility ("disable-whole-program-visibility", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Disable whole program visibility (overrides enabling options)")) |
Provide a way to force disable whole program for debugging or workarounds, when enabled via the linker. More... | |
cl::list< std::string > | SkipFunctionNames ("wholeprogramdevirt-skip", cl::desc("Prevent function(s) from being devirtualized"), cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated) |
Provide way to prevent certain function from being devirtualized. More... | |
wholeprogramdevirt | |
Whole program | devirtualization |
Whole program | false |
#define DEBUG_TYPE "wholeprogramdevirt" |
Definition at line 107 of file WholeProgramDevirt.cpp.
Definition at line 1057 of file WholeProgramDevirt.cpp.
References Callee, llvm::X86AS::FS, llvm::CalleeInfo::Hot, and P.
|
static |
Definition at line 845 of file WholeProgramDevirt.cpp.
References ClSummaryAction, llvm::createStringError(), llvm::ModuleSummaryIndex::getRegularLTOModuleName(), llvm::Import, llvm::invalid_argument, and llvm::ModuleSummaryIndex::modulePaths().
Definition at line 770 of file WholeProgramDevirt.cpp.
References DisableWholeProgramVisibility, and WholeProgramVisibility.
Referenced by llvm::updateVCallVisibilityInIndex(), and llvm::updateVCallVisibilityInModule().
INITIALIZE_PASS_BEGIN | ( | WholeProgramDevirt | , |
"wholeprogramdevirt" | , | ||
"Whole program devirtualization" | , | ||
false | , | ||
false | |||
) |
|
static |
|
static |
Referenced by checkCombinedSummaryForTesting().
|
static |
|
static |
Whole program devirtualization |
Definition at line 734 of file WholeProgramDevirt.cpp.
cl::opt<bool> DisableWholeProgramVisibility("disable-whole-program-visibility", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Disable whole program visibility (overrides enabling options)")) |
Provide a way to force disable whole program for debugging or workarounds, when enabled via the linker.
Referenced by hasWholeProgramVisibility().
Whole program false |
Definition at line 734 of file WholeProgramDevirt.cpp.
|
static |
cl::list<std::string> SkipFunctionNames("wholeprogramdevirt-skip", cl::desc("Prevent function(s) from being devirtualized"), cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated) |
Provide way to prevent certain function from being devirtualized.
wholeprogramdevirt |
Definition at line 734 of file WholeProgramDevirt.cpp.
cl::opt<bool> WholeProgramVisibility("whole-program-visibility", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Enable whole program visibility")) |
Provide a way to force enable whole program visibility in tests.
This is needed to support legacy tests that don't contain !vcall_visibility metadata (the mere presense of type tests previously implied hidden visibility).
Referenced by hasWholeProgramVisibility().