2828#include " llvm/IR/Instruction.h"
2929#include " llvm/IR/Instructions.h"
3030#include " llvm/IR/IntrinsicInst.h"
31- #include " llvm/InitializePasses.h"
3231#include " llvm/Support/Debug.h"
3332#include " llvm/Support/raw_ostream.h"
3433#include " llvm/Transforms/Scalar.h"
3534
36- #define AA_NAME " alignment-from-assumptions"
37- #define DEBUG_TYPE AA_NAME
35+ #define DEBUG_TYPE " alignment-from-assumptions"
3836using namespace llvm ;
3937
4038STATISTIC (NumLoadAlignChanged,
@@ -44,46 +42,6 @@ STATISTIC(NumStoreAlignChanged,
4442STATISTIC (NumMemIntAlignChanged,
4543 " Number of memory intrinsics changed by alignment assumptions" );
4644
47- namespace {
48- struct AlignmentFromAssumptions : public FunctionPass {
49- static char ID; // Pass identification, replacement for typeid
50- AlignmentFromAssumptions () : FunctionPass(ID) {
51- initializeAlignmentFromAssumptionsPass (*PassRegistry::getPassRegistry ());
52- }
53-
54- bool runOnFunction (Function &F) override ;
55-
56- void getAnalysisUsage (AnalysisUsage &AU) const override {
57- AU.addRequired <AssumptionCacheTracker>();
58- AU.addRequired <ScalarEvolutionWrapperPass>();
59- AU.addRequired <DominatorTreeWrapperPass>();
60-
61- AU.setPreservesCFG ();
62- AU.addPreserved <AAResultsWrapperPass>();
63- AU.addPreserved <GlobalsAAWrapperPass>();
64- AU.addPreserved <LoopInfoWrapperPass>();
65- AU.addPreserved <DominatorTreeWrapperPass>();
66- AU.addPreserved <ScalarEvolutionWrapperPass>();
67- }
68-
69- AlignmentFromAssumptionsPass Impl;
70- };
71- }
72-
73- char AlignmentFromAssumptions::ID = 0 ;
74- static const char aip_name[] = " Alignment from assumptions" ;
75- INITIALIZE_PASS_BEGIN (AlignmentFromAssumptions, AA_NAME,
76- aip_name, false , false )
77- INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
78- INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
79- INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass)
80- INITIALIZE_PASS_END(AlignmentFromAssumptions, AA_NAME,
81- aip_name, false , false )
82-
83- FunctionPass *llvm::createAlignmentFromAssumptionsPass() {
84- return new AlignmentFromAssumptions ();
85- }
86-
8745// Given an expression for the (constant) alignment, AlignSCEV, and an
8846// expression for the displacement between a pointer and the aligned address,
8947// DiffSCEV, compute the alignment of the displaced pointer if it can be reduced
@@ -317,17 +275,6 @@ bool AlignmentFromAssumptionsPass::processAssumption(CallInst *ACall,
317275 return true ;
318276}
319277
320- bool AlignmentFromAssumptions::runOnFunction (Function &F) {
321- if (skipFunction (F))
322- return false ;
323-
324- auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache (F);
325- ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE ();
326- DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree ();
327-
328- return Impl.runImpl (F, AC, SE, DT);
329- }
330-
331278bool AlignmentFromAssumptionsPass::runImpl (Function &F, AssumptionCache &AC,
332279 ScalarEvolution *SE_,
333280 DominatorTree *DT_) {
0 commit comments