LLVM 23.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 <variant>
32#include <vector>
33
34namespace llvm {
35
36class AAResults;
37class AssumeInst;
38class AssumptionCache;
39class BasicBlock;
40class CallInst;
41class CondBrInst;
43class Function;
44class FunctionPass;
47class LoadInst;
48class LoopInfo;
49class MemDepResult;
50class MemoryAccess;
52class MemoryLocation;
53class MemorySSA;
57class PHINode;
59class Value;
60class IntrinsicInst;
61/// A private "module" namespace for types and utilities used by GVN. These
62/// are implementation details and should not be used by clients.
64
65struct AvailableValue;
67class GVNLegacyPass;
68
69} // end namespace gvn
70
71/// A set of parameters to control various transforms performed by GVN pass.
72// Each of the optional boolean parameters can be set to:
73/// true - enabling the transformation.
74/// false - disabling the transformation.
75/// None - relying on a global default.
76/// Intended use is to create a default object, modify parameters with
77/// additional setters and then pass it to GVN.
78struct GVNOptions {
79 std::optional<bool> AllowPRE;
80 std::optional<bool> AllowLoadPRE;
81 std::optional<bool> AllowLoadInLoopPRE;
82 std::optional<bool> AllowLoadPRESplitBackedge;
83 std::optional<bool> AllowMemDep;
84 std::optional<bool> AllowMemorySSA;
85
86 GVNOptions() = default;
87
88 /// Enables or disables PRE in GVN.
89 GVNOptions &setPRE(bool PRE) {
90 AllowPRE = PRE;
91 return *this;
92 }
93
94 /// Enables or disables PRE of loads in GVN.
95 GVNOptions &setLoadPRE(bool LoadPRE) {
96 AllowLoadPRE = LoadPRE;
97 return *this;
98 }
99
100 GVNOptions &setLoadInLoopPRE(bool LoadInLoopPRE) {
101 AllowLoadInLoopPRE = LoadInLoopPRE;
102 return *this;
103 }
104
105 /// Enables or disables PRE of loads in GVN.
106 GVNOptions &setLoadPRESplitBackedge(bool LoadPRESplitBackedge) {
107 AllowLoadPRESplitBackedge = LoadPRESplitBackedge;
108 return *this;
109 }
110
111 /// Enables or disables use of MemDepAnalysis.
112 GVNOptions &setMemDep(bool MemDep) {
113 AllowMemDep = MemDep;
114 return *this;
115 }
116
117 /// Enables or disables use of MemorySSA.
118 GVNOptions &setMemorySSA(bool MemSSA) {
119 AllowMemorySSA = MemSSA;
120 return *this;
121 }
122};
123
124/// The core GVN pass object.
125///
126/// FIXME: We should have a good summary of the GVN algorithm implemented by
127/// this particular pass here.
128class GVNPass : public PassInfoMixin<GVNPass> {
129 GVNOptions Options;
130
131public:
132 struct Expression;
133
134 GVNPass(GVNOptions Options = {}) : Options(Options) {}
135
136 /// Run the pass over the function.
137 LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
138
139 LLVM_ABI void
140 printPipeline(raw_ostream &OS,
141 function_ref<StringRef(StringRef)> MapClassName2PassName);
142
143 /// This removes the specified instruction from
144 /// our various maps and marks it for deletion.
145 LLVM_ABI void salvageAndRemoveInstruction(Instruction *I);
146
147 DominatorTree &getDominatorTree() const { return *DT; }
148 AAResults *getAliasAnalysis() const { return VN.getAliasAnalysis(); }
149 MemoryDependenceResults &getMemDep() const { return *MD; }
150
151 LLVM_ABI bool isPREEnabled() const;
152 LLVM_ABI bool isLoadPREEnabled() const;
153 LLVM_ABI bool isLoadInLoopPREEnabled() const;
155 LLVM_ABI bool isMemDepEnabled() const;
156 LLVM_ABI bool isMemorySSAEnabled() const;
157
158 /// This class holds the mapping between values and value numbers. It is used
159 /// as an efficient mechanism to determine the expression-wise equivalence of
160 /// two values.
162 DenseMap<Value *, uint32_t> ValueNumbering;
163 DenseMap<Expression, uint32_t> ExpressionNumbering;
164
165 // Expressions is the vector of Expression. ExprIdx is the mapping from
166 // value number to the index of Expression in Expressions. We use it
167 // instead of a DenseMap because filling such mapping is faster than
168 // filling a DenseMap and the compile time is a little better.
169 uint32_t NextExprNumber = 0;
170
171 std::vector<Expression> Expressions;
172 std::vector<uint32_t> ExprIdx;
173
174 // Value number to PHINode mapping. Used for phi-translate in scalarpre.
176
177 // Value number to BasicBlock mapping. Used for phi-translate across
178 // MemoryPhis.
180
181 // Cache for phi-translate in scalarpre.
182 using PhiTranslateMap =
184 PhiTranslateMap PhiTranslateTable;
185
186 AAResults *AA = nullptr;
187 MemoryDependenceResults *MD = nullptr;
188 bool IsMDEnabled = false;
189 MemorySSA *MSSA = nullptr;
190 bool IsMSSAEnabled = false;
191 DominatorTree *DT = nullptr;
192
193 uint32_t NextValueNumber = 1;
194
195 Expression createExpr(Instruction *I);
196 Expression createCmpExpr(unsigned Opcode, CmpInst::Predicate Predicate,
197 Value *LHS, Value *RHS);
198 Expression createExtractvalueExpr(ExtractValueInst *EI);
199 Expression createGEPExpr(GetElementPtrInst *GEP);
200 uint32_t lookupOrAddCall(CallInst *C);
201 uint32_t computeLoadStoreVN(Instruction *I);
202 uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock,
203 uint32_t Num, GVNPass &GVN);
204 bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred,
205 const BasicBlock *PhiBlock, GVNPass &GVN);
206 std::pair<uint32_t, bool> assignExpNewValueNum(Expression &Exp);
207 bool areAllValsInBB(uint32_t Num, const BasicBlock *BB, GVNPass &GVN);
208 void addMemoryStateToExp(Instruction *I, Expression &Exp);
209
210 public:
216
219 LLVM_ABI uint32_t lookup(Value *V, bool Verify = true) const;
221 Value *LHS, Value *RHS);
223 const BasicBlock *PhiBlock, uint32_t Num,
224 GVNPass &GVN);
226 const BasicBlock &CurrBlock);
227 LLVM_ABI bool exists(Value *V) const;
228 LLVM_ABI void add(Value *V, uint32_t Num);
229 LLVM_ABI void clear();
230 LLVM_ABI void erase(Value *V);
231 void setAliasAnalysis(AAResults *A) { AA = A; }
232 AAResults *getAliasAnalysis() const { return AA; }
233 void setMemDep(MemoryDependenceResults *M, bool MDEnabled = true) {
234 MD = M;
235 IsMDEnabled = MDEnabled;
236 }
237 void setMemorySSA(MemorySSA *M, bool MSSAEnabled = false) {
238 MSSA = M;
239 IsMSSAEnabled = MSSAEnabled;
240 }
241 void setDomTree(DominatorTree *D) { DT = D; }
242 uint32_t getNextUnusedValueNumber() { return NextValueNumber; }
243 LLVM_ABI void verifyRemoved(const Value *) const;
244 };
245
246private:
247 friend class gvn::GVNLegacyPass;
248 friend struct DenseMapInfo<Expression>;
249
250 MemoryDependenceResults *MD = nullptr;
251 DominatorTree *DT = nullptr;
252 const TargetLibraryInfo *TLI = nullptr;
253 AssumptionCache *AC = nullptr;
254 SetVector<BasicBlock *> DeadBlocks;
255 OptimizationRemarkEmitter *ORE = nullptr;
256 ImplicitControlFlowTracking *ICF = nullptr;
257 LoopInfo *LI = nullptr;
258 MemorySSAUpdater *MSSAU = nullptr;
259
260 ValueTable VN;
261
262 /// A mapping from value numbers to lists of Value*'s that
263 /// have that value number. Use findLeader to query it.
264 class LeaderMap {
265 public:
267 // Use AssertingVH here to catch dangling Value*'s in the leader table.
268 // Will crash if the value gets deleted before the AssertingVH is
269 // destroyed.
273 };
274
275 private:
276 struct LeaderListNode {
277 LeaderTableEntry Entry;
278 LeaderListNode *Next;
279 LeaderListNode(Value *V, const BasicBlock *BB, LeaderListNode *Next)
280 : Entry(V, BB), Next(Next) {}
281 };
282 DenseMap<uint32_t, LeaderListNode> NumToLeaders;
283 BumpPtrAllocator TableAllocator;
284
285 public:
287 const LeaderListNode *Current;
288
289 public:
290 using iterator_category = std::forward_iterator_tag;
292 using difference_type = std::ptrdiff_t;
295
296 leader_iterator(const LeaderListNode *C) : Current(C) {}
298 assert(Current && "Dereferenced end of leader list!");
299 Current = Current->Next;
300 return *this;
301 }
302 bool operator==(const leader_iterator &Other) const {
303 return Current == Other.Current;
304 }
305 bool operator!=(const leader_iterator &Other) const {
306 return Current != Other.Current;
307 }
308 reference operator*() const { return Current->Entry; }
309 };
310
312 auto I = NumToLeaders.find(N);
313 if (I == NumToLeaders.end()) {
314 return iterator_range(leader_iterator(nullptr),
315 leader_iterator(nullptr));
316 }
317
318 return iterator_range(leader_iterator(&I->second),
319 leader_iterator(nullptr));
320 }
321
322 LLVM_ABI void insert(uint32_t N, Value *V, const BasicBlock *BB);
323 LLVM_ABI void erase(uint32_t N, Instruction *I, const BasicBlock *BB);
324 void clear() {
325 // Manually destroy non-head nodes (in BumpPtrAllocator) to properly
326 // clean up AssertingVH handles before Reset(). Head nodes are destroyed
327 // by NumToLeaders.clear() below.
328 for (auto &[_, HeadNode] : NumToLeaders) {
329 LeaderListNode *N = HeadNode.Next;
330 while (N) {
331 auto *Next = N->Next;
332 N->~LeaderListNode();
333 N = Next;
334 }
335 }
336 NumToLeaders.clear();
337 TableAllocator.Reset();
338 }
339 };
340 LeaderMap LeaderTable;
341
342 // Map the block to reversed postorder traversal number. It is used to
343 // find back edge easily.
344 DenseMap<AssertingVH<BasicBlock>, uint32_t> BlockRPONumber;
345
346 // This is set 'true' initially and also when new blocks have been added to
347 // the function being analyzed. This boolean is used to control the updating
348 // of BlockRPONumber prior to accessing the contents of BlockRPONumber.
349 bool InvalidBlockRPONumbers = true;
350
351 using LoadDepVect = SmallVector<NonLocalDepResult, 64>;
352 using AvailValInBlkVect = SmallVector<gvn::AvailableValueInBlock, 64>;
353 using UnavailBlkVect = SmallVector<BasicBlock *, 64>;
354
355 bool runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT,
356 const TargetLibraryInfo &RunTLI, AAResults &RunAA,
357 MemoryDependenceResults *RunMD, LoopInfo &LI,
358 OptimizationRemarkEmitter *ORE, MemorySSA *MSSA = nullptr);
359
360 // List of critical edges to be split between iterations.
362
363 // Helper functions of redundant load elimination.
364 bool processLoad(LoadInst *L);
365 bool processMaskedLoad(IntrinsicInst *I);
366 bool processNonLocalLoad(LoadInst *L);
367 bool processAssumeIntrinsic(AssumeInst *II);
368
369 /// Given a local dependency (Def or Clobber) determine if a value is
370 /// available for the load.
371 std::optional<gvn::AvailableValue>
372 AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, Value *Address);
373
374 /// Given a list of non-local dependencies, determine if a value is
375 /// available for the load in each specified block. If it is, add it to
376 /// ValuesPerBlock. If not, add it to UnavailableBlocks.
377 void AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps,
378 AvailValInBlkVect &ValuesPerBlock,
379 UnavailBlkVect &UnavailableBlocks);
380
381 /// Given a critical edge from Pred to LoadBB, find a load instruction
382 /// which is identical to Load from another successor of Pred.
383 LoadInst *findLoadToHoistIntoPred(BasicBlock *Pred, BasicBlock *LoadBB,
384 LoadInst *Load);
385
386 bool PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
387 UnavailBlkVect &UnavailableBlocks);
388
389 /// Try to replace a load which executes on each loop iteraiton with Phi
390 /// translation of load in preheader and load(s) in conditionally executed
391 /// paths.
392 bool performLoopLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
393 UnavailBlkVect &UnavailableBlocks);
394
395 /// Eliminates partially redundant \p Load, replacing it with \p
396 /// AvailableLoads (connected by Phis if needed).
397 void eliminatePartiallyRedundantLoad(
398 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
399 MapVector<BasicBlock *, Value *> &AvailableLoads,
400 MapVector<BasicBlock *, LoadInst *> *CriticalEdgePredAndLoad);
401
402 // Other helper routines.
403 bool processInstruction(Instruction *I);
404 bool processBlock(BasicBlock *BB);
405 void dump(DenseMap<uint32_t, Value *> &Map) const;
406 bool iterateOnFunction(Function &F);
407 bool performPRE(Function &F);
408 bool performScalarPRE(Instruction *I);
409 bool performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
410 BasicBlock *Curr, unsigned int ValNo);
411 Value *findLeader(const BasicBlock *BB, uint32_t Num);
412 void cleanupGlobalSets();
413 void removeInstruction(Instruction *I);
414 void verifyRemoved(const Instruction *I) const;
415 bool splitCriticalEdges();
416 BasicBlock *splitCriticalEdges(BasicBlock *Pred, BasicBlock *Succ);
417 bool
418 propagateEquality(Value *LHS, Value *RHS,
419 const std::variant<BasicBlockEdge, Instruction *> &Root);
420 bool processFoldableCondBr(CondBrInst *BI);
421 void addDeadBlock(BasicBlock *BB);
422 void assignValNumForDeadCode();
423 void assignBlockRPONumber(Function &F);
424};
425
426/// Create a legacy GVN pass.
428
429/// A simple and fast domtree-based GVN pass to hoist common expressions
430/// from sibling branches.
431struct GVNHoistPass : PassInfoMixin<GVNHoistPass> {
432 /// Run the pass over the function.
434};
435
436/// Uses an "inverted" value numbering to decide the similarity of
437/// expressions and sinks similar expressions into successors.
438struct GVNSinkPass : PassInfoMixin<GVNSinkPass> {
439 /// Run the pass over the function.
441};
442
443} // end namespace llvm
444
445#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
Hexagon Common GEP
#define _
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:54
#define I(x, y, z)
Definition MD5.cpp:57
This file implements a map that provides insertion order iteration.
uint64_t IntrinsicInst * II
ppc ctr loops PowerPC CTR Loops Verify
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Value * RHS
Value * LHS
Value handle that asserts if the Value is deleted.
This represents the llvm.assume intrinsic.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
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:676
Conditional Branch instruction.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:159
This instruction extracts a struct member or array element value from an aggregate value.
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
const LeaderTableEntry value_type
Definition GVN.h:291
std::forward_iterator_tag iterator_category
Definition GVN.h:290
bool operator==(const leader_iterator &Other) const
Definition GVN.h:302
bool operator!=(const leader_iterator &Other) const
Definition GVN.h:305
leader_iterator(const LeaderListNode *C)
Definition GVN.h:296
This class holds the mapping between values and value numbers.
Definition GVN.h:161
void setMemDep(MemoryDependenceResults *M, bool MDEnabled=true)
Definition GVN.h:233
LLVM_ABI ValueTable(ValueTable &&Arg)
void setMemorySSA(MemorySSA *M, bool MSSAEnabled=false)
Definition GVN.h:237
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:748
uint32_t getNextUnusedValueNumber()
Definition GVN.h:242
LLVM_ABI uint32_t lookup(Value *V, bool Verify=true) const
Returns the value number of the specified value.
Definition GVN.cpp:735
LLVM_ABI ValueTable & operator=(const ValueTable &Arg)
void setAliasAnalysis(AAResults *A)
Definition GVN.h:231
LLVM_ABI void add(Value *V, uint32_t Num)
add - Insert a value into the table with a specified value number.
Definition GVN.cpp:467
LLVM_ABI void clear()
Remove all entries from the ValueTable.
Definition GVN.cpp:756
LLVM_ABI bool exists(Value *V) const
Returns true if a value number exists for the specified value.
Definition GVN.cpp:638
LLVM_ABI ValueTable(const ValueTable &Arg)
LLVM_ABI uint32_t lookupOrAdd(MemoryAccess *MA)
Definition GVN.cpp:642
AAResults * getAliasAnalysis() const
Definition GVN.h:232
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:2263
void setDomTree(DominatorTree *D)
Definition GVN.h:241
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:2393
LLVM_ABI void erase(Value *V)
Remove a value from the value numbering.
Definition GVN.cpp:769
LLVM_ABI void verifyRemoved(const Value *) const
verifyRemoved - Verify that the value is removed from all internal data structures.
Definition GVN.cpp:781
LLVM_ABI bool isPREEnabled() const
Definition GVN.cpp:846
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition GVN.cpp:871
LLVM_ABI void salvageAndRemoveInstruction(Instruction *I)
This removes the specified instruction from our various maps and marks it for deletion.
Definition GVN.cpp:923
AAResults * getAliasAnalysis() const
Definition GVN.h:148
LLVM_ABI bool isLoadPREEnabled() const
Definition GVN.cpp:850
GVNPass(GVNOptions Options={})
Definition GVN.h:134
LLVM_ABI void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
Definition GVN.cpp:903
LLVM_ABI bool isMemorySSAEnabled() const
Definition GVN.cpp:867
DominatorTree & getDominatorTree() const
Definition GVN.h:147
LLVM_ABI bool isLoadInLoopPREEnabled() const
Definition GVN.cpp:854
LLVM_ABI bool isLoadPRESplitBackedgeEnabled() const
Definition GVN.cpp:858
LLVM_ABI bool isMemDepEnabled() const
Definition GVN.cpp:863
MemoryDependenceResults & getMemDep() const
Definition GVN.h:149
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
This class allows to keep track on instructions with implicit control flow.
A wrapper class for inspecting calls to intrinsic functions.
An instruction for reading from memory.
A memory dependence query can return one of three different answers.
Provides a lazy, caching interface for making common memory aliasing information queries,...
Representation for a specific memory location.
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition MemorySSA.h:702
This is a result from a NonLocal dependence query.
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:57
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
A private "module" namespace for types and utilities used by GVN.
Definition GVN.h:63
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Definition InstrProf.h:137
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
@ Other
Any other memory.
Definition ModRef.h:68
LLVM_ABI FunctionPass * createGVNPass()
Create a legacy GVN pass.
Definition GVN.cpp:3398
FunctionAddr VTableAddr Next
Definition InstrProf.h:141
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
#define N
An information struct used to provide DenseMap with the various necessary components for a given valu...
A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches.
Definition GVN.h:431
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
A set of parameters to control various transforms performed by GVN pass.
Definition GVN.h:78
GVNOptions & setLoadPRE(bool LoadPRE)
Enables or disables PRE of loads in GVN.
Definition GVN.h:95
std::optional< bool > AllowLoadPRESplitBackedge
Definition GVN.h:82
GVNOptions & setPRE(bool PRE)
Enables or disables PRE in GVN.
Definition GVN.h:89
GVNOptions & setLoadInLoopPRE(bool LoadInLoopPRE)
Definition GVN.h:100
std::optional< bool > AllowPRE
Definition GVN.h:79
std::optional< bool > AllowLoadInLoopPRE
Definition GVN.h:81
std::optional< bool > AllowMemDep
Definition GVN.h:83
GVNOptions & setMemDep(bool MemDep)
Enables or disables use of MemDepAnalysis.
Definition GVN.h:112
std::optional< bool > AllowLoadPRE
Definition GVN.h:80
GVNOptions & setLoadPRESplitBackedge(bool LoadPRESplitBackedge)
Enables or disables PRE of loads in GVN.
Definition GVN.h:106
std::optional< bool > AllowMemorySSA
Definition GVN.h:84
GVNOptions()=default
GVNOptions & setMemorySSA(bool MemSSA)
Enables or disables use of MemorySSA.
Definition GVN.h:118
LeaderTableEntry(Value *V, const BasicBlock *BB)
Definition GVN.h:272
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
Definition GVN.h:438
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition GVNSink.cpp:855
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:289
Represents a particular available value that we know how to materialize.
Definition GVN.cpp:193