16 #ifndef LLVM_TRANSFORMS_SCALAR_GVN_H 17 #define LLVM_TRANSFORMS_SCALAR_GVN_H 38 class AssumptionCache;
43 class ExtractValueInst;
49 class OptimizationRemarkEmitter;
51 class TargetLibraryInfo;
58 struct AvailableValue;
59 struct AvailableValueInBlock;
79 InstrsToErase.push_back(I);
100 std::vector<uint32_t> ExprIdx;
114 uint32_t nextValueNumber = 1;
122 uint32_t Num,
GVN &Gvn);
123 std::pair<uint32_t, bool> assignExpNewValueNum(
Expression &exp);
124 bool areAllValsInBB(uint32_t num,
const BasicBlock *BB,
GVN &Gvn);
132 uint32_t lookupOrAdd(
Value *V);
137 uint32_t Num,
GVN &Gvn);
138 void eraseTranslateCacheEntry(uint32_t Num,
const BasicBlock &CurrBlock);
142 void erase(
Value *v);
148 void verifyRemoved(
const Value *)
const;
163 FirstImplicitControlFlowInsts;
170 struct LeaderTableEntry {
173 LeaderTableEntry *Next;
199 LeaderTableEntry &Curr = LeaderTable[
N];
206 LeaderTableEntry *Node = TableAllocator.
Allocate<LeaderTableEntry>();
209 Node->Next = Curr.Next;
216 LeaderTableEntry *Prev =
nullptr;
217 LeaderTableEntry *Curr = &LeaderTable[
N];
219 while (Curr && (Curr->Val != I || Curr->BB != BB)) {
228 Prev->Next = Curr->Next;
234 LeaderTableEntry *Next = Curr->Next;
235 Curr->Val = Next->Val;
237 Curr->Next = Next->Next;
247 bool processNonLocalLoad(
LoadInst *L);
270 bool iterateOnFunction(
Function &F);
276 void cleanupGlobalSets();
277 void fillImplicitControlFlowInfo(
BasicBlock *BB);
279 bool splitCriticalEdges();
281 bool replaceOperandsWithConsts(
Instruction *I)
const;
283 bool DominatesByEdge);
286 void assignValNumForDeadCode();
287 void assignBlockRPONumber(
Function &F);
310 #endif // LLVM_TRANSFORMS_SCALAR_GVN_H
void setDomTree(DominatorTree *D)
FunctionPass * createGVNPass(bool NoLoads=false)
Create a legacy GVN pass.
static bool runImpl(Function &F, TargetLibraryInfo &TLI, DominatorTree &DT)
This is the entry point for all transforms.
AliasAnalysis * getAliasAnalysis() const
Provides a lazy, caching interface for making common memory aliasing information queries, backed by LLVM's alias analysis passes.
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
AliasAnalysis * getAliasAnalysis() const
Compute iterated dominance frontiers using a linear time algorithm.
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
This class represents a function call, abstracting a target machine's calling convention.
A cache of @llvm.assume calls within a function.
void setAliasAnalysis(AliasAnalysis *A)
An instruction for reading from memory.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
gvn Early GVN Hoisting of Expressions
A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches...
MemoryDependenceResults & getMemDep() const
A MapVector that performs no allocations if smaller than a certain size.
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
ppc ctr loops PowerPC CTR Loops Verify
The core GVN pass object.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
This class holds the mapping between values and value numbers.
Allocate memory in an ever growing pool, as if by bump-pointer.
Conditional or Unconditional Branch instruction.
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
FunctionPass class - This class is used to implement most global optimizations.
A memory dependence query can return one of three different answers.
DominatorTree & getDominatorTree() const
void markInstructionForDeletion(Instruction *I)
This removes the specified instruction from our various maps and marks it for deletion.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void clear(coro::Shape &Shape)
amdgpu Simplify well known AMD library false Value Value * Arg
void setMemDep(MemoryDependenceResults *M)
Represents a particular available value that we know how to materialize.
uint32_t getNextUnusedValueNumber()
LLVM Value Representation.
A vector that has set insertion semantics.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
bool exists(const basic_file_status &status)
Does file exist?
A wrapper class for inspecting calls to intrinsic functions.