1 //===---- AlignmentFromAssumptions.h ----------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements a ScalarEvolution-based transformation to set 11 // the alignments of load, stores and memory intrinsics based on the truth 12 // expressions of assume intrinsics. The primary motivation is to handle 13 // complex alignment assumptions that apply to vector loads and stores that 14 // appear after vectorization and unrolling. 15 // 16 //===----------------------------------------------------------------------===// 17 18 #ifndef LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H 19 #define LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H 20 21 #include "llvm/Analysis/ScalarEvolution.h" 22 #include "llvm/IR/Function.h" 23 #include "llvm/IR/IntrinsicInst.h" 24 #include "llvm/IR/PassManager.h" 25 26 namespace llvm { 27 28 struct AlignmentFromAssumptionsPass 29 : public PassInfoMixin<AlignmentFromAssumptionsPass> { 30 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 31 32 // Glue for old PM. 33 bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_, 34 DominatorTree *DT_); 35 36 ScalarEvolution *SE = nullptr; 37 DominatorTree *DT = nullptr; 38 39 bool extractAlignmentInfo(CallInst *I, Value *&AAPtr, const SCEV *&AlignSCEV, 40 const SCEV *&OffSCEV); 41 bool processAssumption(CallInst *I); 42 }; 43 } 44 45 #endif // LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H 46