LLVM  4.0.0
AlignmentFromAssumptions.h
Go to the documentation of this file.
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 
22 #include "llvm/IR/Function.h"
23 #include "llvm/IR/IntrinsicInst.h"
24 #include "llvm/IR/PassManager.h"
25 
26 namespace llvm {
27 
29  : public PassInfoMixin<AlignmentFromAssumptionsPass> {
31 
32  // Glue for old PM.
34  DominatorTree *DT_);
35 
36  // For memory transfers, we need a common alignment for both the source and
37  // destination. If we have a new alignment for only one operand of a transfer
38  // instruction, save it in these maps. If we reach the other operand through
39  // another assumption later, then we may change the alignment at that point.
41 
42  ScalarEvolution *SE = nullptr;
43  DominatorTree *DT = nullptr;
44 
45  bool extractAlignmentInfo(CallInst *I, Value *&AAPtr, const SCEV *&AlignSCEV,
46  const SCEV *&OffSCEV);
48 };
49 }
50 
51 #endif // LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H
DenseMap< MemTransferInst *, unsigned > NewSrcAlignments
The main scalar evolution driver.
This class represents a function call, abstracting a target machine's calling convention.
A cache of .assume calls within a function.
DenseMap< MemTransferInst *, unsigned > NewDestAlignments
#define F(x, y, z)
Definition: MD5.cpp:51
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:311
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:96
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:107
bool extractAlignmentInfo(CallInst *I, Value *&AAPtr, const SCEV *&AlignSCEV, const SCEV *&OffSCEV)
This class represents an analyzed expression in the program.
#define I(x, y, z)
Definition: MD5.cpp:54
LLVM Value Representation.
Definition: Value.h:71
bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_, DominatorTree *DT_)
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.