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