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;
42class Function;
43class FunctionPass;
46class LoadInst;
47class LoopInfo;
48class MemDepResult;
49class MemoryAccess;
51class MemoryLocation;
52class MemorySSA;
56class PHINode;
58class Value;
59class IntrinsicInst;
60/// A private "module" namespace for types and utilities used by GVN. These
61/// are implementation details and should not be used by clients.
63
64struct AvailableValue;
66class GVNLegacyPass;
67
68} // end namespace gvn
69
70/// A set of parameters to control various transforms performed by GVN pass.
71// Each of the optional boolean parameters can be set to:
72/// true - enabling the transformation.
73/// false - disabling the transformation.
74/// None - relying on a global default.
75/// Intended use is to create a default object, modify parameters with
76/// additional setters and then pass it to GVN.
77struct GVNOptions {
78 std::optional<bool> AllowPRE;
79 std::optional<bool> AllowLoadPRE;
80 std::optional<bool> AllowLoadInLoopPRE;
81 std::optional<bool> AllowLoadPRESplitBackedge;
82 std::optional<bool> AllowMemDep;
83 std::optional<bool> AllowMemorySSA;
84
85 GVNOptions() = default;
86
87 /// Enables or disables PRE in GVN.
88 GVNOptions &setPRE(bool PRE) {
89 AllowPRE = PRE;
90 return *this;
91 }
92
93 /// Enables or disables PRE of loads in GVN.
94 GVNOptions &setLoadPRE(bool LoadPRE) {
95 AllowLoadPRE = LoadPRE;
96 return *this;
97 }
98
99 GVNOptions &setLoadInLoopPRE(bool LoadInLoopPRE) {
100 AllowLoadInLoopPRE = LoadInLoopPRE;
101 return *this;
102 }
103
104 /// Enables or disables PRE of loads in GVN.
105 GVNOptions &setLoadPRESplitBackedge(bool LoadPRESplitBackedge) {
106 AllowLoadPRESplitBackedge = LoadPRESplitBackedge;
107 return *this;
108 }
109
110 /// Enables or disables use of MemDepAnalysis.
111 GVNOptions &setMemDep(bool MemDep) {
112 AllowMemDep = MemDep;
113 return *this;
114 }
115
116 /// Enables or disables use of MemorySSA.
117 GVNOptions &setMemorySSA(bool MemSSA) {
118 AllowMemorySSA = MemSSA;
119 return *this;
120 }
121};
122
123/// The core GVN pass object.
124///
125/// FIXME: We should have a good summary of the GVN algorithm implemented by
126/// this particular pass here.
127class GVNPass : public PassInfoMixin<GVNPass> {
128 GVNOptions Options;
129
130public:
131 struct Expression;
132
133 GVNPass(GVNOptions Options = {}) : Options(Options) {}
134
135 /// Run the pass over the function.
136 LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
137
138 LLVM_ABI void
139 printPipeline(raw_ostream &OS,
140 function_ref<StringRef(StringRef)> MapClassName2PassName);
141
142 /// This removes the specified instruction from
143 /// our various maps and marks it for deletion.
144 LLVM_ABI void salvageAndRemoveInstruction(Instruction *I);
145
146 DominatorTree &getDominatorTree() const { return *DT; }
147 AAResults *getAliasAnalysis() const { return VN.getAliasAnalysis(); }
148 MemoryDependenceResults &getMemDep() const { return *MD; }
149
150 LLVM_ABI bool isPREEnabled() const;
151 LLVM_ABI bool isLoadPREEnabled() const;
152 LLVM_ABI bool isLoadInLoopPREEnabled() const;
154 LLVM_ABI bool isMemDepEnabled() const;
155 LLVM_ABI bool isMemorySSAEnabled() const;
156
157 /// This class holds the mapping between values and value numbers. It is used
158 /// as an efficient mechanism to determine the expression-wise equivalence of
159 /// two values.
161 DenseMap<Value *, uint32_t> ValueNumbering;
162 DenseMap<Expression, uint32_t> ExpressionNumbering;
163
164 // Expressions is the vector of Expression. ExprIdx is the mapping from
165 // value number to the index of Expression in Expressions. We use it
166 // instead of a DenseMap because filling such mapping is faster than
167 // filling a DenseMap and the compile time is a little better.
168 uint32_t NextExprNumber = 0;
169
170 std::vector<Expression> Expressions;
171 std::vector<uint32_t> ExprIdx;
172
173 // Value number to PHINode mapping. Used for phi-translate in scalarpre.
175
176 // Value number to BasicBlock mapping. Used for phi-translate across
177 // MemoryPhis.
179
180 // Cache for phi-translate in scalarpre.
181 using PhiTranslateMap =
183 PhiTranslateMap PhiTranslateTable;
184
185 AAResults *AA = nullptr;
186 MemoryDependenceResults *MD = nullptr;
187 bool IsMDEnabled = false;
188 MemorySSA *MSSA = nullptr;
189 bool IsMSSAEnabled = false;
190 DominatorTree *DT = nullptr;
191
192 uint32_t NextValueNumber = 1;
193
194 Expression createExpr(Instruction *I);
195 Expression createCmpExpr(unsigned Opcode, CmpInst::Predicate Predicate,
196 Value *LHS, Value *RHS);
197 Expression createExtractvalueExpr(ExtractValueInst *EI);
198 Expression createGEPExpr(GetElementPtrInst *GEP);
199 uint32_t lookupOrAddCall(CallInst *C);
200 uint32_t computeLoadStoreVN(Instruction *I);
201 uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock,
202 uint32_t Num, GVNPass &GVN);
203 bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred,
204 const BasicBlock *PhiBlock, GVNPass &GVN);
205 std::pair<uint32_t, bool> assignExpNewValueNum(Expression &Exp);
206 bool areAllValsInBB(uint32_t Num, const BasicBlock *BB, GVNPass &GVN);
207 void addMemoryStateToExp(Instruction *I, Expression &Exp);
208
209 public:
215
218 LLVM_ABI uint32_t lookup(Value *V, bool Verify = true) const;
220 Value *LHS, Value *RHS);
222 const BasicBlock *PhiBlock, uint32_t Num,
223 GVNPass &GVN);
225 const BasicBlock &CurrBlock);
226 LLVM_ABI bool exists(Value *V) const;
227 LLVM_ABI void add(Value *V, uint32_t Num);
228 LLVM_ABI void clear();
229 LLVM_ABI void erase(Value *V);
230 void setAliasAnalysis(AAResults *A) { AA = A; }
231 AAResults *getAliasAnalysis() const { return AA; }
232 void setMemDep(MemoryDependenceResults *M, bool MDEnabled = true) {
233 MD = M;
234 IsMDEnabled = MDEnabled;
235 }
236 void setMemorySSA(MemorySSA *M, bool MSSAEnabled = false) {
237 MSSA = M;
238 IsMSSAEnabled = MSSAEnabled;
239 }
240 void setDomTree(DominatorTree *D) { DT = D; }
241 uint32_t getNextUnusedValueNumber() { return NextValueNumber; }
242 LLVM_ABI void verifyRemoved(const Value *) const;
243 };
244
245private:
246 friend class gvn::GVNLegacyPass;
247 friend struct DenseMapInfo<Expression>;
248
249 MemoryDependenceResults *MD = nullptr;
250 DominatorTree *DT = nullptr;
251 const TargetLibraryInfo *TLI = nullptr;
252 AssumptionCache *AC = nullptr;
253 SetVector<BasicBlock *> DeadBlocks;
254 OptimizationRemarkEmitter *ORE = nullptr;
255 ImplicitControlFlowTracking *ICF = nullptr;
256 LoopInfo *LI = nullptr;
257 MemorySSAUpdater *MSSAU = nullptr;
258
259 ValueTable VN;
260
261 /// A mapping from value numbers to lists of Value*'s that
262 /// have that value number. Use findLeader to query it.
263 class LeaderMap {
264 public:
268 };
269
270 private:
271 struct LeaderListNode {
272 LeaderTableEntry Entry;
273 LeaderListNode *Next;
274 };
276 BumpPtrAllocator TableAllocator;
277
278 public:
280 const LeaderListNode *Current;
281
282 public:
283 using iterator_category = std::forward_iterator_tag;
285 using difference_type = std::ptrdiff_t;
288
289 leader_iterator(const LeaderListNode *C) : Current(C) {}
291 assert(Current && "Dereferenced end of leader list!");
292 Current = Current->Next;
293 return *this;
294 }
295 bool operator==(const leader_iterator &Other) const {
296 return Current == Other.Current;
297 }
298 bool operator!=(const leader_iterator &Other) const {
299 return Current != Other.Current;
300 }
301 reference operator*() const { return Current->Entry; }
302 };
303
305 auto I = NumToLeaders.find(N);
306 if (I == NumToLeaders.end()) {
307 return iterator_range(leader_iterator(nullptr),
308 leader_iterator(nullptr));
309 }
310
311 return iterator_range(leader_iterator(&I->second),
312 leader_iterator(nullptr));
313 }
314
315 LLVM_ABI void insert(uint32_t N, Value *V, const BasicBlock *BB);
316 LLVM_ABI void erase(uint32_t N, Instruction *I, const BasicBlock *BB);
317 LLVM_ABI void verifyRemoved(const Value *Inst) const;
318 void clear() {
319 NumToLeaders.clear();
320 TableAllocator.Reset();
321 }
322 };
323 LeaderMap LeaderTable;
324
325 // Block-local map of equivalent values to their leader, does not
326 // propagate to any successors. Entries added mid-block are applied
327 // to the remaining instructions in the block.
328 SmallMapVector<Value *, Value *, 4> ReplaceOperandsWithMap;
329
330 // Map the block to reversed postorder traversal number. It is used to
331 // find back edge easily.
332 DenseMap<AssertingVH<BasicBlock>, uint32_t> BlockRPONumber;
333
334 // This is set 'true' initially and also when new blocks have been added to
335 // the function being analyzed. This boolean is used to control the updating
336 // of BlockRPONumber prior to accessing the contents of BlockRPONumber.
337 bool InvalidBlockRPONumbers = true;
338
339 using LoadDepVect = SmallVector<NonLocalDepResult, 64>;
340 using AvailValInBlkVect = SmallVector<gvn::AvailableValueInBlock, 64>;
341 using UnavailBlkVect = SmallVector<BasicBlock *, 64>;
342
343 bool runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT,
344 const TargetLibraryInfo &RunTLI, AAResults &RunAA,
345 MemoryDependenceResults *RunMD, LoopInfo &LI,
346 OptimizationRemarkEmitter *ORE, MemorySSA *MSSA = nullptr);
347
348 // List of critical edges to be split between iterations.
350
351 // Helper functions of redundant load elimination.
352 bool processLoad(LoadInst *L);
353 bool processMaskedLoad(IntrinsicInst *I);
354 bool processNonLocalLoad(LoadInst *L);
355 bool processAssumeIntrinsic(AssumeInst *II);
356
357 /// Given a local dependency (Def or Clobber) determine if a value is
358 /// available for the load.
359 std::optional<gvn::AvailableValue>
360 AnalyzeLoadAvailability(LoadInst *Load, MemDepResult DepInfo, Value *Address);
361
362 /// Given a list of non-local dependencies, determine if a value is
363 /// available for the load in each specified block. If it is, add it to
364 /// ValuesPerBlock. If not, add it to UnavailableBlocks.
365 void AnalyzeLoadAvailability(LoadInst *Load, LoadDepVect &Deps,
366 AvailValInBlkVect &ValuesPerBlock,
367 UnavailBlkVect &UnavailableBlocks);
368
369 /// Given a critical edge from Pred to LoadBB, find a load instruction
370 /// which is identical to Load from another successor of Pred.
371 LoadInst *findLoadToHoistIntoPred(BasicBlock *Pred, BasicBlock *LoadBB,
372 LoadInst *Load);
373
374 bool PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
375 UnavailBlkVect &UnavailableBlocks);
376
377 /// Try to replace a load which executes on each loop iteraiton with Phi
378 /// translation of load in preheader and load(s) in conditionally executed
379 /// paths.
380 bool performLoopLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
381 UnavailBlkVect &UnavailableBlocks);
382
383 /// Eliminates partially redundant \p Load, replacing it with \p
384 /// AvailableLoads (connected by Phis if needed).
385 void eliminatePartiallyRedundantLoad(
386 LoadInst *Load, AvailValInBlkVect &ValuesPerBlock,
387 MapVector<BasicBlock *, Value *> &AvailableLoads,
388 MapVector<BasicBlock *, LoadInst *> *CriticalEdgePredAndLoad);
389
390 // Other helper routines.
391 bool processInstruction(Instruction *I);
392 bool processBlock(BasicBlock *BB);
393 void dump(DenseMap<uint32_t, Value *> &Map) const;
394 bool iterateOnFunction(Function &F);
395 bool performPRE(Function &F);
396 bool performScalarPRE(Instruction *I);
397 bool performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
398 BasicBlock *Curr, unsigned int ValNo);
399 Value *findLeader(const BasicBlock *BB, uint32_t Num);
400 void cleanupGlobalSets();
401 void removeInstruction(Instruction *I);
402 void verifyRemoved(const Instruction *I) const;
403 bool splitCriticalEdges();
404 BasicBlock *splitCriticalEdges(BasicBlock *Pred, BasicBlock *Succ);
405 bool replaceOperandsForInBlockEquality(Instruction *I) const;
406 bool propagateEquality(Value *LHS, Value *RHS, const BasicBlockEdge &Root,
407 bool DominatesByEdge);
408 bool processFoldableCondBr(BranchInst *BI);
409 void addDeadBlock(BasicBlock *BB);
410 void assignValNumForDeadCode();
411 void assignBlockRPONumber(Function &F);
412};
413
414/// Create a legacy GVN pass.
416
417/// A simple and fast domtree-based GVN pass to hoist common expressions
418/// from sibling branches.
419struct GVNHoistPass : PassInfoMixin<GVNHoistPass> {
420 /// Run the pass over the function.
422};
423
424/// Uses an "inverted" value numbering to decide the similarity of
425/// expressions and sinks similar expressions into successors.
426struct GVNSinkPass : PassInfoMixin<GVNSinkPass> {
427 /// Run the pass over the function.
429};
430
431} // end namespace llvm
432
433#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
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
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Value * RHS
Value * LHS
This represents the llvm.assume intrinsic.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
Conditional or Unconditional Branch instruction.
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:167
iterator end()
Definition DenseMap.h:81
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.
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
const LeaderTableEntry value_type
Definition GVN.h:284
std::forward_iterator_tag iterator_category
Definition GVN.h:283
bool operator==(const leader_iterator &Other) const
Definition GVN.h:295
bool operator!=(const leader_iterator &Other) const
Definition GVN.h:298
leader_iterator(const LeaderListNode *C)
Definition GVN.h:289
This class holds the mapping between values and value numbers.
Definition GVN.h:160
void setMemDep(MemoryDependenceResults *M, bool MDEnabled=true)
Definition GVN.h:232
LLVM_ABI ValueTable(ValueTable &&Arg)
void setMemorySSA(MemorySSA *M, bool MSSAEnabled=false)
Definition GVN.h:236
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:241
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:230
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:231
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:2345
void setDomTree(DominatorTree *D)
Definition GVN.h:240
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:2475
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
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:147
LLVM_ABI bool isLoadPREEnabled() const
Definition GVN.cpp:860
GVNPass(GVNOptions Options={})
Definition GVN.h:133
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:146
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:148
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: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
A private "module" namespace for types and utilities used by GVN.
Definition GVN.h:62
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Definition InstrProf.h:137
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
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:3482
FunctionAddr VTableAddr Next
Definition InstrProf.h:141
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
#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:419
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:77
GVNOptions & setLoadPRE(bool LoadPRE)
Enables or disables PRE of loads in GVN.
Definition GVN.h:94
std::optional< bool > AllowLoadPRESplitBackedge
Definition GVN.h:81
GVNOptions & setPRE(bool PRE)
Enables or disables PRE in GVN.
Definition GVN.h:88
GVNOptions & setLoadInLoopPRE(bool LoadInLoopPRE)
Definition GVN.h:99
std::optional< bool > AllowPRE
Definition GVN.h:78
std::optional< bool > AllowLoadInLoopPRE
Definition GVN.h:80
std::optional< bool > AllowMemDep
Definition GVN.h:82
GVNOptions & setMemDep(bool MemDep)
Enables or disables use of MemDepAnalysis.
Definition GVN.h:111
std::optional< bool > AllowLoadPRE
Definition GVN.h:79
GVNOptions & setLoadPRESplitBackedge(bool LoadPRESplitBackedge)
Enables or disables PRE of loads in GVN.
Definition GVN.h:105
std::optional< bool > AllowMemorySSA
Definition GVN.h:83
GVNOptions()=default
GVNOptions & setMemorySSA(bool MemSSA)
Enables or disables use of MemorySSA.
Definition GVN.h:117
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
Definition GVN.h:426
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