LLVM 22.0.0git
GVN.h
Go to the documentation of this file.
1//===- GVN.h - Eliminate redundant values and loads -------------*- 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/// \file
9/// This file provides the interface for LLVM's Global Value Numbering pass
10/// which eliminates fully redundant instructions. It also does somewhat Ad-Hoc
11/// PRE and dead load elimination.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TRANSFORMS_SCALAR_GVN_H
16#define LLVM_TRANSFORMS_SCALAR_GVN_H
17
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/MapVector.h"
20#include "llvm/ADT/SetVector.h"
22#include "llvm/IR/Dominators.h"
23#include "llvm/IR/InstrTypes.h"
24#include "llvm/IR/PassManager.h"
25#include "llvm/IR/ValueHandle.h"
28#include <cstdint>
29#include <optional>
30#include <utility>
31#include <vector>
32
33namespace llvm {
34
35class AAResults;
36class AssumeInst;
37class AssumptionCache;
38class BasicBlock;
39class BranchInst;
40class CallInst;
41class ExtractValueInst;
42class Function;
43class FunctionPass;
44class GetElementPtrInst;
45class ImplicitControlFlowTracking;
46class LoadInst;
47class LoopInfo;
48class MemDepResult;
49class MemoryAccess;
50class MemoryDependenceResults;
51class MemoryLocation;
52class MemorySSA;
53class MemorySSAUpdater;
54class NonLocalDepResult;
55class OptimizationRemarkEmitter;
56class PHINode;
57class TargetLibraryInfo;
58class Value;
59/// A private "module" namespace for types and utilities used by GVN. These
60/// are implementation details and should not be used by clients.
62
63struct AvailableValue;
65class GVNLegacyPass;
66
67} // end namespace gvn
68
69/// A set of parameters to control various transforms performed by GVN pass.
70// Each of the optional boolean parameters can be set to:
71/// true - enabling the transformation.
72/// false - disabling the transformation.
73/// None - relying on a global default.
74/// Intended use is to create a default object, modify parameters with
75/// additional setters and then pass it to GVN.
76struct GVNOptions {
77 std::optional<bool> AllowPRE;
78 std::optional<bool> AllowLoadPRE;
79 std::optional<bool> AllowLoadInLoopPRE;
80 std::optional<bool> AllowLoadPRESplitBackedge;
81 std::optional<bool> AllowMemDep;
82 std::optional<bool> AllowMemorySSA;
83
84 GVNOptions() = default;
85
86 /// Enables or disables PRE in GVN.
87 GVNOptions &setPRE(bool PRE) {
88 AllowPRE = PRE;
89 return *this;
90 }
91
92 /// Enables or disables PRE of loads in GVN.
93 GVNOptions &setLoadPRE(bool LoadPRE) {
94 AllowLoadPRE = LoadPRE;
95 return *this;
96 }
97
98 GVNOptions &setLoadInLoopPRE(bool LoadInLoopPRE) {
99 AllowLoadInLoopPRE = LoadInLoopPRE;
100 return *this;
101 }
102
103 /// Enables or disables PRE of loads in GVN.
104 GVNOptions &setLoadPRESplitBackedge(bool LoadPRESplitBackedge) {
105 AllowLoadPRESplitBackedge = LoadPRESplitBackedge;
106 return *this;
107 }
108
109 /// Enables or disables use of MemDepAnalysis.
110 GVNOptions &setMemDep(bool MemDep) {
111 AllowMemDep = MemDep;
112 return *this;
113 }
114
115 /// Enables or disables use of MemorySSA.
116 GVNOptions &setMemorySSA(bool MemSSA) {
117 AllowMemorySSA = MemSSA;
118 return *this;
119 }
120};
121
122/// The core GVN pass object.
123///
124/// FIXME: We should have a good summary of the GVN algorithm implemented by
125/// this particular pass here.
126class GVNPass : public PassInfoMixin<GVNPass> {
127 GVNOptions Options;
128
129public:
130 struct Expression;
131
133
134 /// Run the pass over the function.
135 LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
136
137 LLVM_ABI void
138 printPipeline(raw_ostream &OS,
139 function_ref<StringRef(StringRef)> MapClassName2PassName);
140
141 /// This removes the specified instruction from
142 /// our various maps and marks it for deletion.
143 LLVM_ABI void salvageAndRemoveInstruction(Instruction *I);
144
145 DominatorTree &getDominatorTree() const { return *DT; }
147 MemoryDependenceResults &getMemDep() const { return *MD; }
148
149 LLVM_ABI bool isPREEnabled() const;
150 LLVM_ABI bool isLoadPREEnabled() const;
151 LLVM_ABI bool isLoadInLoopPREEnabled() const;
153 LLVM_ABI bool isMemDepEnabled() const;
154 LLVM_ABI bool isMemorySSAEnabled() const;
155
156 /// This class holds the mapping between values and value numbers. It is used
157 /// as an efficient mechanism to determine the expression-wise equivalence of
158 /// two values.
160 DenseMap<Value *, uint32_t> ValueNumbering;
161 DenseMap<Expression, uint32_t> ExpressionNumbering;
162
163 // Expressions is the vector of Expression. ExprIdx is the mapping from
164 // value number to the index of Expression in Expressions. We use it
165 // instead of a DenseMap because filling such mapping is faster than
166 // filling a DenseMap and the compile time is a little better.
167 uint32_t NextExprNumber = 0;
168
169 std::vector<Expression> Expressions;
170 std::vector<uint32_t> ExprIdx;
171
172 // Value number to PHINode mapping. Used for phi-translate in scalarpre.
174
175 // Value number to BasicBlock mapping. Used for phi-translate across
176 // MemoryPhis.
178
179 // Cache for phi-translate in scalarpre.
180 using PhiTranslateMap =
182 PhiTranslateMap PhiTranslateTable;
183
184 AAResults *AA = nullptr;
185 MemoryDependenceResults *MD = nullptr;
186 bool IsMDEnabled = false;
187 MemorySSA *MSSA = nullptr;
188 bool IsMSSAEnabled = false;
189 DominatorTree *DT = nullptr;
190
191 uint32_t NextValueNumber = 1;
192
193 Expression createExpr(Instruction *I);
194 Expression createCmpExpr(unsigned Opcode, CmpInst::Predicate Predicate,
195 Value *LHS, Value *RHS);
196 Expression createExtractvalueExpr(ExtractValueInst *EI);
197 Expression createGEPExpr(GetElementPtrInst *GEP);
198 uint32_t lookupOrAddCall(CallInst *C);
199 uint32_t computeLoadStoreVN(Instruction *I);
200 uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock,
201 uint32_t Num, GVNPass &GVN);
202 bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred,
203 const BasicBlock *PhiBlock, GVNPass &GVN);
204 std::pair<uint32_t, bool> assignExpNewValueNum(Expression &Exp);
205 bool areAllValsInBB(uint32_t Num, const BasicBlock *BB, GVNPass &GVN);
206 void addMemoryStateToExp(Instruction *I, Expression &Exp);
207
208 public:
214
217 LLVM_ABI uint32_t lookup(Value *V, bool Verify = true) const;
219 Value *LHS, Value *RHS);
221 const BasicBlock *PhiBlock, uint32_t Num,
222 GVNPass &GVN);
224 const BasicBlock &CurrBlock);
225 LLVM_ABI bool exists(Value *V) const;
226 LLVM_ABI void add(Value *V, uint32_t Num);
227 LLVM_ABI void clear();
228 LLVM_ABI void erase(Value *V);
229 void setAliasAnalysis(AAResults *A) { AA = A; }
230 AAResults *getAliasAnalysis() const { return AA; }
231 void setMemDep(MemoryDependenceResults *M, bool MDEnabled = true) {
232 MD = M;
233 IsMDEnabled = MDEnabled;
234 }
235 void setMemorySSA(MemorySSA *M, bool MSSAEnabled = false) {
236 MSSA = M;
237 IsMSSAEnabled = MSSAEnabled;
238 }
239 void setDomTree(DominatorTree *D) { DT = D; }
240 uint32_t getNextUnusedValueNumber() { return NextValueNumber; }
241 LLVM_ABI void verifyRemoved(const Value *) const;
242 };
243
244private:
245 friend class gvn::GVNLegacyPass;
246 friend struct DenseMapInfo<Expression>;
247
248 MemoryDependenceResults *MD = nullptr;
249 DominatorTree *DT = nullptr;
250 const TargetLibraryInfo *TLI = nullptr;
251 AssumptionCache *AC = nullptr;
252 SetVector<BasicBlock *> DeadBlocks;
253 OptimizationRemarkEmitter *ORE = nullptr;
254 ImplicitControlFlowTracking *ICF = nullptr;
255 LoopInfo *LI = nullptr;
256 MemorySSAUpdater *MSSAU = nullptr;
257
258 ValueTable VN;
259
260 /// A mapping from value numbers to lists of Value*'s that
261 /// have that value number. Use findLeader to query it.
262 class LeaderMap {
263 public:
267 };
268
269 private:
270 struct LeaderListNode {
271 LeaderTableEntry Entry;
272 LeaderListNode *Next;
273 };
275 BumpPtrAllocator TableAllocator;
276
277 public:
279 const LeaderListNode *Current;
280
281 public:
282 using iterator_category = std::forward_iterator_tag;
284 using difference_type = std::ptrdiff_t;
287
288 leader_iterator(const LeaderListNode *C) : Current(C) {}
290 assert(Current && "Dereferenced end of leader list!");
291 Current = Current->Next;
292 return *this;
293 }
294 bool operator==(const leader_iterator &Other) const {
295 return Current == Other.Current;
296 }
297 bool operator!=(const leader_iterator &Other) const {
298 return Current != Other.Current;
299 }
300 reference operator*() const { return Current->Entry; }
301 };
302
304 auto I = NumToLeaders.find(N);
305 if (I == NumToLeaders.end()) {
306 return iterator_range(leader_iterator(nullptr),
307 leader_iterator(nullptr));
308 }
309
310 return iterator_range(leader_iterator(&I->second),
311 leader_iterator(nullptr));
312 }
313
314 LLVM_ABI void insert(uint32_t N, Value *V, const BasicBlock *BB);
315 LLVM_ABI void erase(uint32_t N, Instruction *I, const BasicBlock *BB);
316 LLVM_ABI void verifyRemoved(const Value *Inst) const;
317 void clear() {
318 NumToLeaders.clear();
319 TableAllocator.Reset();
320 }
321 };
322 LeaderMap LeaderTable;
323
324 // Block-local map of equivalent values to their leader, does not
325 // propagate to any successors. Entries added mid-block are applied
326 // to the remaining instructions in the block.
327 SmallMapVector<Value *, Value *, 4> ReplaceOperandsWithMap;
328
329 // Map the block to reversed postorder traversal number. It is used to
330 // find back edge easily.
331 DenseMap<AssertingVH<BasicBlock>, uint32_t> BlockRPONumber;
332
333 // This is set 'true' initially and also when new blocks have been added to
334 // the function being analyzed. This boolean is used to control the updating
335 // of BlockRPONumber prior to accessing the contents of BlockRPONumber.
336 bool InvalidBlockRPONumbers = true;
337
338 using LoadDepVect = SmallVector<NonLocalDepResult, 64>;
339 using AvailValInBlkVect = SmallVector<gvn::AvailableValueInBlock, 64>;
340 using UnavailBlkVect = SmallVector<BasicBlock *, 64>;
341
342 bool runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT,
343 const TargetLibraryInfo &RunTLI, AAResults &RunAA,
344 MemoryDependenceResults *RunMD, LoopInfo &LI,
345 OptimizationRemarkEmitter *ORE, MemorySSA *MSSA = nullptr);
346
347 // List of critical edges to be split between iterations.
348 SmallVector<std::pair<Instruction *, unsigned>, 4> ToSplit;
349
350 // Helper functions of redundant load elimination.
351 bool processLoad(LoadInst *L);
352 bool processNonLocalLoad(LoadInst *L);
353 bool processAssumeIntrinsic(AssumeInst *II);
354
355 /// Given a local dependency (Def or Clobber) determine if a value is
356 /// available for the load.
357 std::optional<gvn::AvailableValue>
358 AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, Value *Address);
359
360 /// Given a list of non-local dependencies, determine if a value is
361 /// available for the load in each specified block. If it is, add it to
362 /// ValuesPerBlock. If not, add it to UnavailableBlocks.
363 void AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps,
364 AvailValInBlkVect &ValuesPerBlock,
365 UnavailBlkVect &UnavailableBlocks);
366
367 /// Given a critical edge from Pred to LoadBB, find a load instruction
368 /// which is identical to Load from another successor of Pred.
369 LoadInst *findLoadToHoistIntoPred(BasicBlock *Pred, BasicBlock *LoadBB,
370 LoadInst *Load);
371
372 bool PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
373 UnavailBlkVect &UnavailableBlocks);
374
375 /// Try to replace a load which executes on each loop iteraiton with Phi
376 /// translation of load in preheader and load(s) in conditionally executed
377 /// paths.
378 bool performLoopLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
379 UnavailBlkVect &UnavailableBlocks);
380
381 /// Eliminates partially redundant \p Load, replacing it with \p
382 /// AvailableLoads (connected by Phis if needed).
383 void eliminatePartiallyRedundantLoad(
384 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
385 MapVector<BasicBlock *, Value *> &AvailableLoads,
386 MapVector<BasicBlock *, LoadInst *> *CriticalEdgePredAndLoad);
387
388 // Other helper routines.
389 bool processInstruction(Instruction *I);
390 bool processBlock(BasicBlock *BB);
391 void dump(DenseMap<uint32_t, Value *> &Map) const;
392 bool iterateOnFunction(Function &F);
393 bool performPRE(Function &F);
394 bool performScalarPRE(Instruction *I);
395 bool performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
396 BasicBlock *Curr, unsigned int ValNo);
397 Value *findLeader(const BasicBlock *BB, uint32_t Num);
398 void cleanupGlobalSets();
399 void removeInstruction(Instruction *I);
400 void verifyRemoved(const Instruction *I) const;
401 bool splitCriticalEdges();
402 BasicBlock *splitCriticalEdges(BasicBlock *Pred, BasicBlock *Succ);
403 bool replaceOperandsForInBlockEquality(Instruction *I) const;
404 bool propagateEquality(Value *LHS, Value *RHS, const BasicBlockEdge &Root,
405 bool DominatesByEdge);
406 bool processFoldableCondBr(BranchInst *BI);
407 void addDeadBlock(BasicBlock *BB);
408 void assignValNumForDeadCode();
409 void assignBlockRPONumber(Function &F);
410};
411
412/// Create a legacy GVN pass.
413LLVM_ABI FunctionPass *createGVNPass();
414
415/// A simple and fast domtree-based GVN pass to hoist common expressions
416/// from sibling branches.
417struct GVNHoistPass : PassInfoMixin<GVNHoistPass> {
418 /// Run the pass over the function.
420};
421
422/// Uses an "inverted" value numbering to decide the similarity of
423/// expressions and sinks similar expressions into successors.
424struct GVNSinkPass : PassInfoMixin<GVNSinkPass> {
425 /// Run the pass over the function.
427};
428
429} // end namespace llvm
430
431#endif // LLVM_TRANSFORMS_SCALAR_GVN_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_LIBRARY_VISIBILITY_NAMESPACE
Definition: Compiler.h:143
This file defines the DenseMap class.
early cse Early CSE w MemorySSA
Definition: EarlyCSE.cpp:1962
Hexagon Common GEP
This header defines various interfaces for pass management in LLVM.
static LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
This file implements a map that provides insertion order iteration.
uint64_t IntrinsicInst * II
ppc ctr loops PowerPC CTR Loops Verify
raw_pwrite_stream & OS
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Value * RHS
Value * LHS
A private abstract base class describing the concept of an individual alias analysis implementation.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition: BasicBlock.h:62
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it,...
Definition: Allocator.h:124
This class represents a function call, abstracting a target machine's calling convention.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:678
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:177
iterator end()
Definition: DenseMap.h:87
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:165
This instruction extracts a struct member or array element value from an aggregate value.
std::forward_iterator_tag iterator_category
Definition: GVN.h:282
bool operator==(const leader_iterator &Other) const
Definition: GVN.h:294
bool operator!=(const leader_iterator &Other) const
Definition: GVN.h:297
leader_iterator(const LeaderListNode *C)
Definition: GVN.h:288
leader_iterator & operator++()
Definition: GVN.h:289
This class holds the mapping between values and value numbers.
Definition: GVN.h:159
void setMemDep(MemoryDependenceResults *M, bool MDEnabled=true)
Definition: GVN.h:231
LLVM_ABI ValueTable(ValueTable &&Arg)
void setMemorySSA(MemorySSA *M, bool MSSAEnabled=false)
Definition: GVN.h:235
LLVM_ABI uint32_t lookupOrAddCmp(unsigned Opcode, CmpInst::Predicate Pred, Value *LHS, Value *RHS)
Returns the value number of the given comparison, assigning it a new number if it did not have one be...
Definition: GVN.cpp:751
uint32_t getNextUnusedValueNumber()
Definition: GVN.h:240
LLVM_ABI uint32_t lookup(Value *V, bool Verify=true) const
Returns the value number of the specified value.
Definition: GVN.cpp:738
LLVM_ABI ValueTable & operator=(const ValueTable &Arg)
void setAliasAnalysis(AAResults *A)
Definition: GVN.h:229
LLVM_ABI void add(Value *V, uint32_t Num)
add - Insert a value into the table with a specified value number.
Definition: GVN.cpp:471
LLVM_ABI void clear()
Remove all entries from the ValueTable.
Definition: GVN.cpp:759
LLVM_ABI bool exists(Value *V) const
Returns true if a value number exists for the specified value.
Definition: GVN.cpp:642
LLVM_ABI ValueTable(const ValueTable &Arg)
LLVM_ABI uint32_t lookupOrAdd(MemoryAccess *MA)
Definition: GVN.cpp:646
AAResults * getAliasAnalysis() const
Definition: GVN.h:230
LLVM_ABI uint32_t phiTranslate(const BasicBlock *BB, const BasicBlock *PhiBlock, uint32_t Num, GVNPass &GVN)
Wrap phiTranslateImpl to provide caching functionality.
Definition: GVN.cpp:2316
void setDomTree(DominatorTree *D)
Definition: GVN.h:239
LLVM_ABI void eraseTranslateCacheEntry(uint32_t Num, const BasicBlock &CurrBlock)
Erase stale entry from phiTranslate cache so phiTranslate can be computed again.
Definition: GVN.cpp:2446
LLVM_ABI void erase(Value *V)
Remove a value from the value numbering.
Definition: GVN.cpp:772
LLVM_ABI void verifyRemoved(const Value *) const
verifyRemoved - Verify that the value is removed from all internal data structures.
Definition: GVN.cpp:784
The core GVN pass object.
Definition: GVN.h:126
LLVM_ABI bool isPREEnabled() const
Definition: GVN.cpp:856
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition: GVN.cpp:881
LLVM_ABI void salvageAndRemoveInstruction(Instruction *I)
This removes the specified instruction from our various maps and marks it for deletion.
Definition: GVN.cpp:933
AAResults * getAliasAnalysis() const
Definition: GVN.h:146
LLVM_ABI bool isLoadPREEnabled() const
Definition: GVN.cpp:860
GVNPass(GVNOptions Options={})
Definition: GVN.h:132
LLVM_ABI void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
Definition: GVN.cpp:913
LLVM_ABI bool isMemorySSAEnabled() const
Definition: GVN.cpp:877
DominatorTree & getDominatorTree() const
Definition: GVN.h:145
LLVM_ABI bool isLoadInLoopPREEnabled() const
Definition: GVN.cpp:864
LLVM_ABI bool isLoadPRESplitBackedgeEnabled() const
Definition: GVN.cpp:868
LLVM_ABI bool isMemDepEnabled() const
Definition: GVN.cpp:873
MemoryDependenceResults & getMemDep() const
Definition: GVN.h:147
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Definition: Instructions.h:949
This class allows to keep track on instructions with implicit control flow.
Provides a lazy, caching interface for making common memory aliasing information queries,...
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition: MemorySSA.h:702
The optimization diagnostic interface.
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
A vector that has set insertion semantics.
Definition: SetVector.h:59
Provides information about what library functions are available for the current target.
LLVM Value Representation.
Definition: Value.h:75
A range adaptor for a pair of iterators.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:81
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Definition: PassManager.h:564
@ Other
Any other memory.
LLVM_ABI FunctionPass * createGVNPass()
Create a legacy GVN pass.
Definition: GVN.cpp:3448
#define N
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:54
A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches.
Definition: GVN.h:417
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition: GVNHoist.cpp:1201
A set of parameters to control various transforms performed by GVN pass.
Definition: GVN.h:76
GVNOptions & setLoadPRE(bool LoadPRE)
Enables or disables PRE of loads in GVN.
Definition: GVN.h:93
std::optional< bool > AllowLoadPRESplitBackedge
Definition: GVN.h:80
GVNOptions & setPRE(bool PRE)
Enables or disables PRE in GVN.
Definition: GVN.h:87
GVNOptions & setLoadInLoopPRE(bool LoadInLoopPRE)
Definition: GVN.h:98
std::optional< bool > AllowPRE
Definition: GVN.h:77
std::optional< bool > AllowLoadInLoopPRE
Definition: GVN.h:79
std::optional< bool > AllowMemDep
Definition: GVN.h:81
GVNOptions & setMemDep(bool MemDep)
Enables or disables use of MemDepAnalysis.
Definition: GVN.h:110
std::optional< bool > AllowLoadPRE
Definition: GVN.h:78
GVNOptions & setLoadPRESplitBackedge(bool LoadPRESplitBackedge)
Enables or disables PRE of loads in GVN.
Definition: GVN.h:104
std::optional< bool > AllowMemorySSA
Definition: GVN.h:82
GVNOptions()=default
GVNOptions & setMemorySSA(bool MemSSA)
Enables or disables use of MemorySSA.
Definition: GVN.h:116
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
Definition: GVN.h:424
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition: GVNSink.cpp:856
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70
Represents an AvailableValue which can be rematerialized at the end of the associated BasicBlock.
Definition: GVN.cpp:293
Represents a particular available value that we know how to materialize.
Definition: GVN.cpp:197