From cf59f649ffa14818487713fd2636992b62a69a76 Mon Sep 17 00:00:00 2001 From: Bjorn Pettersson Date: Sun, 16 Apr 2023 23:17:58 +0200 Subject: [PATCH] Re-apply "[Passes] Remove legacy PM versions of InstructionNamer and MetaRenamer" A new attempt after removing uses of -instnamer in polly lit tests in D148530. --- llvm/include/llvm/InitializePasses.h | 2 -- llvm/include/llvm/LinkAllPasses.h | 2 -- llvm/include/llvm/Transforms/Utils.h | 12 -------- llvm/lib/Transforms/Utils/InstructionNamer.cpp | 33 +-------------------- llvm/lib/Transforms/Utils/MetaRenamer.cpp | 41 -------------------------- llvm/lib/Transforms/Utils/Utils.cpp | 2 -- 6 files changed, 1 insertion(+), 91 deletions(-) diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 68da996..9e9aea5 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -157,7 +157,6 @@ void initializeIndirectBrExpandPassPass(PassRegistry&); void initializeInferAddressSpacesPass(PassRegistry&); void initializeInferFunctionAttrsLegacyPassPass(PassRegistry&); void initializeInstCountLegacyPassPass(PassRegistry &); -void initializeInstNamerPass(PassRegistry&); void initializeInstSimplifyLegacyPassPass(PassRegistry &); void initializeInstructionCombiningPassPass(PassRegistry&); void initializeInstructionSelectPass(PassRegistry&); @@ -256,7 +255,6 @@ void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&); void initializeMemorySSAWrapperPassPass(PassRegistry&); void initializeMergeICmpsLegacyPassPass(PassRegistry &); void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&); -void initializeMetaRenamerPass(PassRegistry&); void initializeModuleDebugInfoLegacyPrinterPass(PassRegistry &); void initializeModuleSummaryIndexWrapperPassPass(PassRegistry&); void initializeModuloScheduleTestPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h index 247d4ed..2b84459 100644 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -137,8 +137,6 @@ namespace { (void) llvm::createMergedLoadStoreMotionPass(); (void) llvm::createGVNPass(); (void) llvm::createPostDomTree(); - (void) llvm::createInstructionNamerPass(); - (void) llvm::createMetaRenamerPass(); (void) llvm::createMergeICmpsLegacyPass(); (void) llvm::createExpandLargeDivRemPass(); (void) llvm::createExpandMemCmpPass(); diff --git a/llvm/include/llvm/Transforms/Utils.h b/llvm/include/llvm/Transforms/Utils.h index bcf3e79..c89d510 100644 --- a/llvm/include/llvm/Transforms/Utils.h +++ b/llvm/include/llvm/Transforms/Utils.h @@ -21,11 +21,6 @@ class FunctionPass; class Pass; //===----------------------------------------------------------------------===// -// createMetaRenamerPass - Rename everything with metasyntatic names. -// -ModulePass *createMetaRenamerPass(); - -//===----------------------------------------------------------------------===// // // LowerInvoke - This pass removes invoke instructions, converting them to call // instructions. @@ -35,13 +30,6 @@ extern char &LowerInvokePassID; //===----------------------------------------------------------------------===// // -// InstructionNamer - Give any unnamed non-void instructions "tmp" names. -// -FunctionPass *createInstructionNamerPass(); -extern char &InstructionNamerID; - -//===----------------------------------------------------------------------===// -// // LowerSwitch - This pass converts SwitchInst instructions into a sequence of // chained binary branch instructions. // diff --git a/llvm/lib/Transforms/Utils/InstructionNamer.cpp b/llvm/lib/Transforms/Utils/InstructionNamer.cpp index f3499c9..3ae570c 100644 --- a/llvm/lib/Transforms/Utils/InstructionNamer.cpp +++ b/llvm/lib/Transforms/Utils/InstructionNamer.cpp @@ -17,9 +17,6 @@ #include "llvm/IR/Function.h" #include "llvm/IR/PassManager.h" #include "llvm/IR/Type.h" -#include "llvm/InitializePasses.h" -#include "llvm/Pass.h" -#include "llvm/Transforms/Utils.h" using namespace llvm; @@ -41,35 +38,7 @@ void nameInstructions(Function &F) { } } -struct InstNamer : public FunctionPass { - static char ID; // Pass identification, replacement for typeid - InstNamer() : FunctionPass(ID) { - initializeInstNamerPass(*PassRegistry::getPassRegistry()); - } - - void getAnalysisUsage(AnalysisUsage &Info) const override { - Info.setPreservesAll(); - } - - bool runOnFunction(Function &F) override { - nameInstructions(F); - return true; - } -}; - - char InstNamer::ID = 0; - } // namespace - -INITIALIZE_PASS(InstNamer, "instnamer", - "Assign names to anonymous instructions", false, false) -char &llvm::InstructionNamerID = InstNamer::ID; -//===----------------------------------------------------------------------===// -// -// InstructionNamer - Give any unnamed non-void instructions "tmp" names. -// -FunctionPass *llvm::createInstructionNamerPass() { - return new InstNamer(); -} +} // namespace PreservedAnalyses InstructionNamerPass::run(Function &F, FunctionAnalysisManager &FAM) { diff --git a/llvm/lib/Transforms/Utils/MetaRenamer.cpp b/llvm/lib/Transforms/Utils/MetaRenamer.cpp index 0ab750a..06ccbf8 100644 --- a/llvm/lib/Transforms/Utils/MetaRenamer.cpp +++ b/llvm/lib/Transforms/Utils/MetaRenamer.cpp @@ -30,10 +30,7 @@ #include "llvm/IR/PassManager.h" #include "llvm/IR/Type.h" #include "llvm/IR/TypeFinder.h" -#include "llvm/InitializePasses.h" -#include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Transforms/Utils.h" using namespace llvm; @@ -199,46 +196,8 @@ void MetaRename(Module &M, } } -struct MetaRenamer : public ModulePass { - // Pass identification, replacement for typeid - static char ID; - - MetaRenamer() : ModulePass(ID) { - initializeMetaRenamerPass(*PassRegistry::getPassRegistry()); - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - AU.setPreservesAll(); - } - - bool runOnModule(Module &M) override { - auto GetTLI = [this](Function &F) -> TargetLibraryInfo & { - return this->getAnalysis().getTLI(F); - }; - MetaRename(M, GetTLI); - return true; - } -}; - } // end anonymous namespace -char MetaRenamer::ID = 0; - -INITIALIZE_PASS_BEGIN(MetaRenamer, "metarenamer", - "Assign new names to everything", false, false) -INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) -INITIALIZE_PASS_END(MetaRenamer, "metarenamer", - "Assign new names to everything", false, false) - -//===----------------------------------------------------------------------===// -// -// MetaRenamer - Rename everything with metasyntactic names. -// -ModulePass *llvm::createMetaRenamerPass() { - return new MetaRenamer(); -} - PreservedAnalyses MetaRenamerPass::run(Module &M, ModuleAnalysisManager &AM) { FunctionAnalysisManager &FAM = AM.getResult(M).getManager(); diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp index c9751bb..401bbe2 100644 --- a/llvm/lib/Transforms/Utils/Utils.cpp +++ b/llvm/lib/Transforms/Utils/Utils.cpp @@ -25,7 +25,6 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) { initializeAssumeBuilderPassLegacyPassPass(Registry); initializeBreakCriticalEdgesPass(Registry); initializeCanonicalizeFreezeInLoopsPass(Registry); - initializeInstNamerPass(Registry); initializeLCSSAWrapperPassPass(Registry); initializeLoopSimplifyPass(Registry); initializeLowerGlobalDtorsLegacyPassPass(Registry); @@ -33,7 +32,6 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) { initializeLowerSwitchLegacyPassPass(Registry); initializePromoteLegacyPassPass(Registry); initializeUnifyFunctionExitNodesLegacyPassPass(Registry); - initializeMetaRenamerPass(Registry); initializeStripGCRelocatesLegacyPass(Registry); initializePredicateInfoPrinterLegacyPassPass(Registry); initializeFixIrreduciblePass(Registry); -- 2.7.4