diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -52,7 +52,6 @@ void initializeAAResultsWrapperPassPass(PassRegistry&); void initializeADCELegacyPassPass(PassRegistry&); void initializeAddDiscriminatorsLegacyPassPass(PassRegistry&); -void initializeAlignmentFromAssumptionsPass(PassRegistry&); void initializeAlwaysInlinerLegacyPassPass(PassRegistry&); void initializeAssignmentTrackingAnalysisPass(PassRegistry &); void initializeAssumeSimplifyPassLegacyPassPass(PassRegistry &); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -69,7 +69,6 @@ return; (void) llvm::createAAEvalPass(); - (void) llvm::createAlignmentFromAssumptionsPass(); (void) llvm::createBasicAAWrapperPass(); (void) llvm::createSCEVAAWrapperPass(); (void) llvm::createTypeBasedAAWrapperPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -24,13 +24,6 @@ class ModulePass; class Pass; -//===----------------------------------------------------------------------===// -// -// AlignmentFromAssumptions - Use assume intrinsics to set load/store -// alignments. -// -FunctionPass *createAlignmentFromAssumptionsPass(); - //===----------------------------------------------------------------------===// // // RedundantDbgInstElimination - This pass removes redundant dbg intrinsics diff --git a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp --- a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp +++ b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp @@ -28,13 +28,11 @@ #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" -#include "llvm/InitializePasses.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" -#define AA_NAME "alignment-from-assumptions" -#define DEBUG_TYPE AA_NAME +#define DEBUG_TYPE "alignment-from-assumptions" using namespace llvm; STATISTIC(NumLoadAlignChanged, @@ -44,46 +42,6 @@ STATISTIC(NumMemIntAlignChanged, "Number of memory intrinsics changed by alignment assumptions"); -namespace { -struct AlignmentFromAssumptions : public FunctionPass { - static char ID; // Pass identification, replacement for typeid - AlignmentFromAssumptions() : FunctionPass(ID) { - initializeAlignmentFromAssumptionsPass(*PassRegistry::getPassRegistry()); - } - - bool runOnFunction(Function &F) override; - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - AU.addRequired(); - AU.addRequired(); - - AU.setPreservesCFG(); - AU.addPreserved(); - AU.addPreserved(); - AU.addPreserved(); - AU.addPreserved(); - AU.addPreserved(); - } - - AlignmentFromAssumptionsPass Impl; -}; -} - -char AlignmentFromAssumptions::ID = 0; -static const char aip_name[] = "Alignment from assumptions"; -INITIALIZE_PASS_BEGIN(AlignmentFromAssumptions, AA_NAME, - aip_name, false, false) -INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) -INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) -INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) -INITIALIZE_PASS_END(AlignmentFromAssumptions, AA_NAME, - aip_name, false, false) - -FunctionPass *llvm::createAlignmentFromAssumptionsPass() { - return new AlignmentFromAssumptions(); -} - // Given an expression for the (constant) alignment, AlignSCEV, and an // expression for the displacement between a pointer and the aligned address, // DiffSCEV, compute the alignment of the displaced pointer if it can be reduced @@ -317,17 +275,6 @@ return true; } -bool AlignmentFromAssumptions::runOnFunction(Function &F) { - if (skipFunction(F)) - return false; - - auto &AC = getAnalysis().getAssumptionCache(F); - ScalarEvolution *SE = &getAnalysis().getSE(); - DominatorTree *DT = &getAnalysis().getDomTree(); - - return Impl.runImpl(F, AC, SE, DT); -} - bool AlignmentFromAssumptionsPass::runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_, DominatorTree *DT_) { diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -27,7 +27,6 @@ /// initializeScalarOptsPasses - Initialize all passes linked into the /// ScalarOpts library. void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeAlignmentFromAssumptionsPass(Registry); initializeCallSiteSplittingLegacyPassPass(Registry); initializeConstantHoistingLegacyPassPass(Registry); initializeDCELegacyPassPass(Registry);