[llvm] r294629 - Rename LowerTypeTestsSummaryAction to PassSummaryAction. NFCI.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 13:45:02 PST 2017
Author: pcc
Date: Thu Feb 9 15:45:01 2017
New Revision: 294629
URL: http://llvm.org/viewvc/llvm-project?rev=294629&view=rev
Log:
Rename LowerTypeTestsSummaryAction to PassSummaryAction. NFCI.
I intend to use the same type with the same semantics in the WholeProgramDevirt
pass.
Differential Revision: https://reviews.llvm.org/D29746
Modified:
llvm/trunk/include/llvm/Transforms/IPO.h
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
Modified: llvm/trunk/include/llvm/Transforms/IPO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=294629&r1=294628&r2=294629&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO.h Thu Feb 9 15:45:01 2017
@@ -215,11 +215,11 @@ ModulePass *createMetaRenamerPass();
/// manager.
ModulePass *createBarrierNoopPass();
-/// What to do with the summary when running the LowerTypeTests pass.
-enum class LowerTypeTestsSummaryAction {
+/// What to do with the summary when running passes that operate on it.
+enum class PassSummaryAction {
None, ///< Do nothing.
- Import, ///< Import typeid resolutions from summary and globals.
- Export, ///< Export typeid resolutions to summary and globals.
+ Import, ///< Import information from summary.
+ Export, ///< Export information to summary.
};
/// \brief This pass lowers type metadata and the llvm.type.test intrinsic to
@@ -227,7 +227,7 @@ enum class LowerTypeTestsSummaryAction {
/// \param Action What to do with the summary passed as Index.
/// \param Index The summary to use for importing or exporting, this can be null
/// when Action is None.
-ModulePass *createLowerTypeTestsPass(LowerTypeTestsSummaryAction Action,
+ModulePass *createLowerTypeTestsPass(PassSummaryAction Action,
ModuleSummaryIndex *Index);
/// \brief This pass export CFI checks for use by external modules.
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=294629&r1=294628&r2=294629&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Thu Feb 9 15:45:01 2017
@@ -718,8 +718,8 @@ ModulePassManager PassBuilder::buildLTOD
// CFI is disabled.
// Enable once we add support for the summary in the new PM.
#if 0
- MPM.addPass(LowerTypeTestsPass(Summary ? LowerTypeTestsSummaryAction::Export :
- LowerTypeTestsSummaryAction::None,
+ MPM.addPass(LowerTypeTestsPass(Summary ? PassSummaryAction::Export :
+ PassSummaryAction::None,
Summary));
#endif
Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=294629&r1=294628&r2=294629&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Thu Feb 9 15:45:01 2017
@@ -42,8 +42,6 @@
using namespace llvm;
using namespace lowertypetests;
-using SummaryAction = LowerTypeTestsSummaryAction;
-
#define DEBUG_TYPE "lowertypetests"
STATISTIC(ByteArraySizeBits, "Byte array size in bits");
@@ -57,13 +55,13 @@ static cl::opt<bool> AvoidReuse(
cl::desc("Try to avoid reuse of byte array addresses using aliases"),
cl::Hidden, cl::init(true));
-static cl::opt<SummaryAction> ClSummaryAction(
+static cl::opt<PassSummaryAction> ClSummaryAction(
"lowertypetests-summary-action",
cl::desc("What to do with the summary when running this pass"),
- cl::values(clEnumValN(SummaryAction::None, "none", "Do nothing"),
- clEnumValN(SummaryAction::Import, "import",
+ cl::values(clEnumValN(PassSummaryAction::None, "none", "Do nothing"),
+ clEnumValN(PassSummaryAction::Import, "import",
"Import typeid resolutions from summary and globals"),
- clEnumValN(SummaryAction::Export, "export",
+ clEnumValN(PassSummaryAction::Export, "export",
"Export typeid resolutions to summary and globals")),
cl::Hidden);
@@ -234,7 +232,7 @@ public:
class LowerTypeTestsModule {
Module &M;
- SummaryAction Action;
+ PassSummaryAction Action;
ModuleSummaryIndex *Summary;
bool LinkerSubsectionsViaSymbols;
@@ -334,7 +332,7 @@ class LowerTypeTestsModule {
void createJumpTable(Function *F, ArrayRef<GlobalTypeMember *> Functions);
public:
- LowerTypeTestsModule(Module &M, SummaryAction Action,
+ LowerTypeTestsModule(Module &M, PassSummaryAction Action,
ModuleSummaryIndex *Summary);
bool lower();
@@ -348,14 +346,14 @@ struct LowerTypeTests : public ModulePas
bool UseCommandLine = false;
- SummaryAction Action;
+ PassSummaryAction Action;
ModuleSummaryIndex *Summary;
LowerTypeTests() : ModulePass(ID), UseCommandLine(true) {
initializeLowerTypeTestsPass(*PassRegistry::getPassRegistry());
}
- LowerTypeTests(SummaryAction Action, ModuleSummaryIndex *Summary)
+ LowerTypeTests(PassSummaryAction Action, ModuleSummaryIndex *Summary)
: ModulePass(ID), Action(Action), Summary(Summary) {
initializeLowerTypeTestsPass(*PassRegistry::getPassRegistry());
}
@@ -375,7 +373,7 @@ INITIALIZE_PASS(LowerTypeTests, "lowerty
false)
char LowerTypeTests::ID = 0;
-ModulePass *llvm::createLowerTypeTestsPass(SummaryAction Action,
+ModulePass *llvm::createLowerTypeTestsPass(PassSummaryAction Action,
ModuleSummaryIndex *Summary) {
return new LowerTypeTests(Action, Summary);
}
@@ -502,7 +500,7 @@ Value *LowerTypeTestsModule::createBitSe
} else {
Constant *ByteArray = TIL.TheByteArray;
if (!LinkerSubsectionsViaSymbols && AvoidReuse &&
- Action != SummaryAction::Import) {
+ Action != PassSummaryAction::Import) {
// Each use of the byte array uses a different alias. This makes the
// backend less likely to reuse previously computed byte array addresses,
// improving the security of the CFI mechanism based on this pass.
@@ -1292,7 +1290,7 @@ void LowerTypeTestsModule::buildBitSetsF
}
/// Lower all type tests in this module.
-LowerTypeTestsModule::LowerTypeTestsModule(Module &M, SummaryAction Action,
+LowerTypeTestsModule::LowerTypeTestsModule(Module &M, PassSummaryAction Action,
ModuleSummaryIndex *Summary)
: M(M), Action(Action), Summary(Summary) {
Triple TargetTriple(M.getTargetTriple());
@@ -1338,10 +1336,10 @@ bool LowerTypeTestsModule::lower() {
Function *TypeTestFunc =
M.getFunction(Intrinsic::getName(Intrinsic::type_test));
if ((!TypeTestFunc || TypeTestFunc->use_empty()) &&
- Action != SummaryAction::Export)
+ Action != PassSummaryAction::Export)
return false;
- if (Action == SummaryAction::Import) {
+ if (Action == PassSummaryAction::Import) {
for (auto UI = TypeTestFunc->use_begin(), UE = TypeTestFunc->use_end();
UI != UE;) {
auto *CI = cast<CallInst>((*UI++).getUser());
@@ -1422,7 +1420,7 @@ bool LowerTypeTestsModule::lower() {
}
}
- if (Action == SummaryAction::Export) {
+ if (Action == PassSummaryAction::Export) {
DenseMap<GlobalValue::GUID, TinyPtrVector<Metadata *>> MetadataByGUID;
for (auto &P : TypeIdInfo) {
if (auto *TypeId = dyn_cast<MDString>(P.first))
@@ -1502,7 +1500,8 @@ bool LowerTypeTestsModule::lower() {
PreservedAnalyses LowerTypeTestsPass::run(Module &M,
ModuleAnalysisManager &AM) {
bool Changed =
- LowerTypeTestsModule(M, SummaryAction::None, /*Summary=*/nullptr).lower();
+ LowerTypeTestsModule(M, PassSummaryAction::None, /*Summary=*/nullptr)
+ .lower();
if (!Changed)
return PreservedAnalyses::all();
return PreservedAnalyses::none();
Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=294629&r1=294628&r2=294629&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Feb 9 15:45:01 2017
@@ -830,8 +830,7 @@ void PassManagerBuilder::populateThinLTO
PM.add(createVerifierPass());
if (Summary)
- PM.add(
- createLowerTypeTestsPass(LowerTypeTestsSummaryAction::Import, Summary));
+ PM.add(createLowerTypeTestsPass(PassSummaryAction::Import, Summary));
populateModulePassManager(PM);
@@ -857,9 +856,8 @@ void PassManagerBuilder::populateLTOPass
// Lower type metadata and the type.test intrinsic. This pass supports Clang's
// control flow integrity mechanisms (-fsanitize=cfi*) and needs to run at
// link time if CFI is enabled. The pass does nothing if CFI is disabled.
- PM.add(createLowerTypeTestsPass(Summary ? LowerTypeTestsSummaryAction::Export
- : LowerTypeTestsSummaryAction::None,
- Summary));
+ PM.add(createLowerTypeTestsPass(
+ Summary ? PassSummaryAction::Export : PassSummaryAction::None, Summary));
if (OptLevel != 0)
addLateLTOOptimizationPasses(PM);
More information about the llvm-commits
mailing list