16 #ifndef LLVM_TRANSFORMS_SCALAR_GVN_H 17 #define LLVM_TRANSFORMS_SCALAR_GVN_H 39 class AssumptionCache;
44 class ExtractValueInst;
50 class OptimizationRemarkEmitter;
52 class TargetLibraryInfo;
59 struct AvailableValue;
60 struct AvailableValueInBlock;
80 InstrsToErase.push_back(I);
101 std::vector<uint32_t> ExprIdx;
115 uint32_t nextValueNumber = 1;
123 uint32_t Num,
GVN &Gvn);
124 std::pair<uint32_t, bool> assignExpNewValueNum(
Expression &
exp);
125 bool areAllValsInBB(uint32_t num,
const BasicBlock *BB,
GVN &Gvn);
133 uint32_t lookupOrAdd(
Value *V);
138 uint32_t Num,
GVN &Gvn);
139 void eraseTranslateCacheEntry(uint32_t Num,
const BasicBlock &CurrBlock);
143 void erase(
Value *v);
149 void verifyRemoved(
const Value *)
const;
168 struct LeaderTableEntry {
171 LeaderTableEntry *Next;
189 bool InvalidBlockRPONumbers =
true;
202 LeaderTableEntry &Curr = LeaderTable[
N];
209 LeaderTableEntry *Node = TableAllocator.
Allocate<LeaderTableEntry>();
212 Node->Next = Curr.Next;
219 LeaderTableEntry *Prev =
nullptr;
220 LeaderTableEntry *Curr = &LeaderTable[
N];
222 while (Curr && (Curr->Val != I || Curr->BB != BB)) {
231 Prev->Next = Curr->Next;
237 LeaderTableEntry *Next = Curr->Next;
238 Curr->Val = Next->Val;
240 Curr->Next = Next->Next;
250 bool processNonLocalLoad(
LoadInst *L);
273 bool iterateOnFunction(
Function &F);
279 void cleanupGlobalSets();
280 void fillImplicitControlFlowInfo(
BasicBlock *BB);
282 bool splitCriticalEdges();
284 bool replaceOperandsWithConsts(
Instruction *I)
const;
286 bool DominatesByEdge);
289 void assignValNumForDeadCode();
290 void assignBlockRPONumber(
Function &F);
313 #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.
AliasAnalysis * getAliasAnalysis() const
This class represents lattice values for constants.
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)
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
This class allows to keep track on instructions with implicit control flow.
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.