LLVM 20.0.0git
SparsePropagation.h
Go to the documentation of this file.
1//===- SparsePropagation.h - Sparse Conditional Property Propagation ------===//
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//
9// This file implements an abstract sparse conditional propagation algorithm,
10// modeled after SCCP, but with a customizable lattice function.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ANALYSIS_SPARSEPROPAGATION_H
15#define LLVM_ANALYSIS_SPARSEPROPAGATION_H
16
18#include "llvm/IR/Constants.h"
20#include "llvm/Support/Debug.h"
21#include <set>
22
23#define DEBUG_TYPE "sparseprop"
24
25namespace llvm {
26
27/// A template for translating between LLVM Values and LatticeKeys. Clients must
28/// provide a specialization of LatticeKeyInfo for their LatticeKey type.
29template <class LatticeKey> struct LatticeKeyInfo {
30 // static inline Value *getValueFromLatticeKey(LatticeKey Key);
31 // static inline LatticeKey getLatticeKeyFromValue(Value *V);
32};
33
34template <class LatticeKey, class LatticeVal,
35 class KeyInfo = LatticeKeyInfo<LatticeKey>>
36class SparseSolver;
37
38/// AbstractLatticeFunction - This class is implemented by the dataflow instance
39/// to specify what the lattice values are and how they handle merges etc. This
40/// gives the client the power to compute lattice values from instructions,
41/// constants, etc. The current requirement is that lattice values must be
42/// copyable. At the moment, nothing tries to avoid copying. Additionally,
43/// lattice keys must be able to be used as keys of a mapping data structure.
44/// Internally, the generic solver currently uses a DenseMap to map lattice keys
45/// to lattice values. If the lattice key is a non-standard type, a
46/// specialization of DenseMapInfo must be provided.
47template <class LatticeKey, class LatticeVal> class AbstractLatticeFunction {
48private:
49 LatticeVal UndefVal, OverdefinedVal, UntrackedVal;
50
51public:
52 AbstractLatticeFunction(LatticeVal undefVal, LatticeVal overdefinedVal,
53 LatticeVal untrackedVal) {
54 UndefVal = undefVal;
55 OverdefinedVal = overdefinedVal;
56 UntrackedVal = untrackedVal;
57 }
58
59 virtual ~AbstractLatticeFunction() = default;
60
61 LatticeVal getUndefVal() const { return UndefVal; }
62 LatticeVal getOverdefinedVal() const { return OverdefinedVal; }
63 LatticeVal getUntrackedVal() const { return UntrackedVal; }
64
65 /// IsUntrackedValue - If the specified LatticeKey is obviously uninteresting
66 /// to the analysis (i.e., it would always return UntrackedVal), this
67 /// function can return true to avoid pointless work.
68 virtual bool IsUntrackedValue(LatticeKey Key) { return false; }
69
70 /// ComputeLatticeVal - Compute and return a LatticeVal corresponding to the
71 /// given LatticeKey.
72 virtual LatticeVal ComputeLatticeVal(LatticeKey Key) {
73 return getOverdefinedVal();
74 }
75
76 /// IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is
77 /// one that the we want to handle through ComputeInstructionState.
78 virtual bool IsSpecialCasedPHI(PHINode *PN) { return false; }
79
80 /// MergeValues - Compute and return the merge of the two specified lattice
81 /// values. Merging should only move one direction down the lattice to
82 /// guarantee convergence (toward overdefined).
83 virtual LatticeVal MergeValues(LatticeVal X, LatticeVal Y) {
84 return getOverdefinedVal(); // always safe, never useful.
85 }
86
87 /// ComputeInstructionState - Compute the LatticeKeys that change as a result
88 /// of executing instruction \p I. Their associated LatticeVals are store in
89 /// \p ChangedValues.
93
94 /// PrintLatticeVal - Render the given LatticeVal to the specified stream.
95 virtual void PrintLatticeVal(LatticeVal LV, raw_ostream &OS);
96
97 /// PrintLatticeKey - Render the given LatticeKey to the specified stream.
98 virtual void PrintLatticeKey(LatticeKey Key, raw_ostream &OS);
99
100 /// GetValueFromLatticeVal - If the given LatticeVal is representable as an
101 /// LLVM value, return it; otherwise, return nullptr. If a type is given, the
102 /// returned value must have the same type. This function is used by the
103 /// generic solver in attempting to resolve branch and switch conditions.
104 virtual Value *GetValueFromLatticeVal(LatticeVal LV, Type *Ty = nullptr) {
105 return nullptr;
106 }
107};
108
109/// SparseSolver - This class is a general purpose solver for Sparse Conditional
110/// Propagation with a programmable lattice function.
111template <class LatticeKey, class LatticeVal, class KeyInfo>
113
114 /// LatticeFunc - This is the object that knows the lattice and how to
115 /// compute transfer functions.
117
118 /// ValueState - Holds the LatticeVals associated with LatticeKeys.
120
121 /// BBExecutable - Holds the basic blocks that are executable.
123
124 /// ValueWorkList - Holds values that should be processed.
125 SmallVector<Value *, 64> ValueWorkList;
126
127 /// BBWorkList - Holds basic blocks that should be processed.
129
130 using Edge = std::pair<BasicBlock *, BasicBlock *>;
131
132 /// KnownFeasibleEdges - Entries in this set are edges which have already had
133 /// PHI nodes retriggered.
134 std::set<Edge> KnownFeasibleEdges;
135
136public:
137 explicit SparseSolver(
139 : LatticeFunc(Lattice) {}
140 SparseSolver(const SparseSolver &) = delete;
142
143 /// Solve - Solve for constants and executable blocks.
144 void Solve();
145
146 void Print(raw_ostream &OS) const;
147
148 /// getExistingValueState - Return the LatticeVal object corresponding to the
149 /// given value from the ValueState map. If the value is not in the map,
150 /// UntrackedVal is returned, unlike the getValueState method.
151 LatticeVal getExistingValueState(LatticeKey Key) const {
152 auto I = ValueState.find(Key);
153 return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
154 }
155
156 /// getValueState - Return the LatticeVal object corresponding to the given
157 /// value from the ValueState map. If the value is not in the map, its state
158 /// is initialized.
159 LatticeVal getValueState(LatticeKey Key);
160
161 /// isEdgeFeasible - Return true if the control flow edge from the 'From'
162 /// basic block to the 'To' basic block is currently feasible. If
163 /// AggressiveUndef is true, then this treats values with unknown lattice
164 /// values as undefined. This is generally only useful when solving the
165 /// lattice, not when querying it.
167 bool AggressiveUndef = false);
168
169 /// isBlockExecutable - Return true if there are any known feasible
170 /// edges into the basic block. This is generally only useful when
171 /// querying the lattice.
173 return BBExecutable.count(BB);
174 }
175
176 /// MarkBlockExecutable - This method can be used by clients to mark all of
177 /// the blocks that are known to be intrinsically live in the processed unit.
179
180private:
181 /// UpdateState - When the state of some LatticeKey is potentially updated to
182 /// the given LatticeVal, this function notices and adds the LLVM value
183 /// corresponding the key to the work list, if needed.
184 void UpdateState(LatticeKey Key, LatticeVal LV);
185
186 /// markEdgeExecutable - Mark a basic block as executable, adding it to the BB
187 /// work list if it is not already executable.
188 void markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest);
189
190 /// getFeasibleSuccessors - Return a vector of booleans to indicate which
191 /// successors are reachable from a given terminator instruction.
192 void getFeasibleSuccessors(Instruction &TI, SmallVectorImpl<bool> &Succs,
193 bool AggressiveUndef);
194
195 void visitInst(Instruction &I);
196 void visitPHINode(PHINode &I);
197 void visitTerminator(Instruction &TI);
198};
199
200//===----------------------------------------------------------------------===//
201// AbstractLatticeFunction Implementation
202//===----------------------------------------------------------------------===//
203
204template <class LatticeKey, class LatticeVal>
206 LatticeVal V, raw_ostream &OS) {
207 if (V == UndefVal)
208 OS << "undefined";
209 else if (V == OverdefinedVal)
210 OS << "overdefined";
211 else if (V == UntrackedVal)
212 OS << "untracked";
213 else
214 OS << "unknown lattice value";
215}
216
217template <class LatticeKey, class LatticeVal>
219 LatticeKey Key, raw_ostream &OS) {
220 OS << "unknown lattice key";
221}
222
223//===----------------------------------------------------------------------===//
224// SparseSolver Implementation
225//===----------------------------------------------------------------------===//
226
227template <class LatticeKey, class LatticeVal, class KeyInfo>
228LatticeVal
230 auto I = ValueState.find(Key);
231 if (I != ValueState.end())
232 return I->second; // Common case, in the map
233
234 if (LatticeFunc->IsUntrackedValue(Key))
235 return LatticeFunc->getUntrackedVal();
236 LatticeVal LV = LatticeFunc->ComputeLatticeVal(Key);
237
238 // If this value is untracked, don't add it to the map.
239 if (LV == LatticeFunc->getUntrackedVal())
240 return LV;
241 return ValueState[Key] = std::move(LV);
242}
243
244template <class LatticeKey, class LatticeVal, class KeyInfo>
246 LatticeVal LV) {
247 auto I = ValueState.find(Key);
248 if (I != ValueState.end() && I->second == LV)
249 return; // No change.
250
251 // Update the state of the given LatticeKey and add its corresponding LLVM
252 // value to the work list.
253 ValueState[Key] = std::move(LV);
254 if (Value *V = KeyInfo::getValueFromLatticeKey(Key))
255 ValueWorkList.push_back(V);
256}
257
258template <class LatticeKey, class LatticeVal, class KeyInfo>
260 BasicBlock *BB) {
261 if (!BBExecutable.insert(BB).second)
262 return;
263 LLVM_DEBUG(dbgs() << "Marking Block Executable: " << BB->getName() << "\n");
264 BBWorkList.push_back(BB); // Add the block to the work list!
265}
266
267template <class LatticeKey, class LatticeVal, class KeyInfo>
269 BasicBlock *Source, BasicBlock *Dest) {
270 if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second)
271 return; // This edge is already known to be executable!
272
273 LLVM_DEBUG(dbgs() << "Marking Edge Executable: " << Source->getName()
274 << " -> " << Dest->getName() << "\n");
275
276 if (BBExecutable.count(Dest)) {
277 // The destination is already executable, but we just made an edge
278 // feasible that wasn't before. Revisit the PHI nodes in the block
279 // because they have potentially new operands.
280 for (BasicBlock::iterator I = Dest->begin(); isa<PHINode>(I); ++I)
281 visitPHINode(*cast<PHINode>(I));
282 } else {
283 MarkBlockExecutable(Dest);
284 }
285}
286
287template <class LatticeKey, class LatticeVal, class KeyInfo>
288void SparseSolver<LatticeKey, LatticeVal, KeyInfo>::getFeasibleSuccessors(
289 Instruction &TI, SmallVectorImpl<bool> &Succs, bool AggressiveUndef) {
290 Succs.resize(TI.getNumSuccessors());
291 if (TI.getNumSuccessors() == 0)
292 return;
293
294 if (BranchInst *BI = dyn_cast<BranchInst>(&TI)) {
295 if (BI->isUnconditional()) {
296 Succs[0] = true;
297 return;
298 }
299
300 LatticeVal BCValue;
301 if (AggressiveUndef)
302 BCValue =
303 getValueState(KeyInfo::getLatticeKeyFromValue(BI->getCondition()));
304 else
305 BCValue = getExistingValueState(
306 KeyInfo::getLatticeKeyFromValue(BI->getCondition()));
307
308 if (BCValue == LatticeFunc->getOverdefinedVal() ||
309 BCValue == LatticeFunc->getUntrackedVal()) {
310 // Overdefined condition variables can branch either way.
311 Succs[0] = Succs[1] = true;
312 return;
313 }
314
315 // If undefined, neither is feasible yet.
316 if (BCValue == LatticeFunc->getUndefVal())
317 return;
318
319 Constant *C =
320 dyn_cast_or_null<Constant>(LatticeFunc->GetValueFromLatticeVal(
321 std::move(BCValue), BI->getCondition()->getType()));
322 if (!C || !isa<ConstantInt>(C)) {
323 // Non-constant values can go either way.
324 Succs[0] = Succs[1] = true;
325 return;
326 }
327
328 // Constant condition variables mean the branch can only go a single way
329 Succs[C->isNullValue()] = true;
330 return;
331 }
332
333 if (!isa<SwitchInst>(TI)) {
334 // Unknown termintor, assume all successors are feasible.
335 Succs.assign(Succs.size(), true);
336 return;
337 }
338
339 SwitchInst &SI = cast<SwitchInst>(TI);
340 LatticeVal SCValue;
341 if (AggressiveUndef)
342 SCValue = getValueState(KeyInfo::getLatticeKeyFromValue(SI.getCondition()));
343 else
344 SCValue = getExistingValueState(
345 KeyInfo::getLatticeKeyFromValue(SI.getCondition()));
346
347 if (SCValue == LatticeFunc->getOverdefinedVal() ||
348 SCValue == LatticeFunc->getUntrackedVal()) {
349 // All destinations are executable!
350 Succs.assign(TI.getNumSuccessors(), true);
351 return;
352 }
353
354 // If undefined, neither is feasible yet.
355 if (SCValue == LatticeFunc->getUndefVal())
356 return;
357
358 Constant *C = dyn_cast_or_null<Constant>(LatticeFunc->GetValueFromLatticeVal(
359 std::move(SCValue), SI.getCondition()->getType()));
360 if (!C || !isa<ConstantInt>(C)) {
361 // All destinations are executable!
362 Succs.assign(TI.getNumSuccessors(), true);
363 return;
364 }
365 SwitchInst::CaseHandle Case = *SI.findCaseValue(cast<ConstantInt>(C));
366 Succs[Case.getSuccessorIndex()] = true;
367}
368
369template <class LatticeKey, class LatticeVal, class KeyInfo>
371 BasicBlock *From, BasicBlock *To, bool AggressiveUndef) {
372 SmallVector<bool, 16> SuccFeasible;
373 Instruction *TI = From->getTerminator();
374 getFeasibleSuccessors(*TI, SuccFeasible, AggressiveUndef);
375
376 for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
377 if (TI->getSuccessor(i) == To && SuccFeasible[i])
378 return true;
379
380 return false;
381}
382
383template <class LatticeKey, class LatticeVal, class KeyInfo>
385 Instruction &TI) {
386 SmallVector<bool, 16> SuccFeasible;
387 getFeasibleSuccessors(TI, SuccFeasible, true);
388
389 BasicBlock *BB = TI.getParent();
390
391 // Mark all feasible successors executable...
392 for (unsigned i = 0, e = SuccFeasible.size(); i != e; ++i)
393 if (SuccFeasible[i])
394 markEdgeExecutable(BB, TI.getSuccessor(i));
395}
396
397template <class LatticeKey, class LatticeVal, class KeyInfo>
398void SparseSolver<LatticeKey, LatticeVal, KeyInfo>::visitPHINode(PHINode &PN) {
399 // The lattice function may store more information on a PHINode than could be
400 // computed from its incoming values. For example, SSI form stores its sigma
401 // functions as PHINodes with a single incoming value.
402 if (LatticeFunc->IsSpecialCasedPHI(&PN)) {
403 SmallDenseMap<LatticeKey, LatticeVal, 16> ChangedValues;
404 LatticeFunc->ComputeInstructionState(PN, ChangedValues, *this);
405 for (auto &ChangedValue : ChangedValues)
406 if (ChangedValue.second != LatticeFunc->getUntrackedVal())
407 UpdateState(std::move(ChangedValue.first),
408 std::move(ChangedValue.second));
409 return;
410 }
411
412 LatticeKey Key = KeyInfo::getLatticeKeyFromValue(&PN);
413 LatticeVal PNIV = getValueState(Key);
414 LatticeVal Overdefined = LatticeFunc->getOverdefinedVal();
415
416 // If this value is already overdefined (common) just return.
417 if (PNIV == Overdefined || PNIV == LatticeFunc->getUntrackedVal())
418 return; // Quick exit
419
420 // Super-extra-high-degree PHI nodes are unlikely to ever be interesting,
421 // and slow us down a lot. Just mark them overdefined.
422 if (PN.getNumIncomingValues() > 64) {
423 UpdateState(Key, Overdefined);
424 return;
425 }
426
427 // Look at all of the executable operands of the PHI node. If any of them
428 // are overdefined, the PHI becomes overdefined as well. Otherwise, ask the
429 // transfer function to give us the merge of the incoming values.
430 for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) {
431 // If the edge is not yet known to be feasible, it doesn't impact the PHI.
432 if (!isEdgeFeasible(PN.getIncomingBlock(i), PN.getParent(), true))
433 continue;
434
435 // Merge in this value.
436 LatticeVal OpVal =
437 getValueState(KeyInfo::getLatticeKeyFromValue(PN.getIncomingValue(i)));
438 if (OpVal != PNIV)
439 PNIV = LatticeFunc->MergeValues(PNIV, OpVal);
440
441 if (PNIV == Overdefined)
442 break; // Rest of input values don't matter.
443 }
444
445 // Update the PHI with the compute value, which is the merge of the inputs.
446 UpdateState(Key, PNIV);
447}
448
449template <class LatticeKey, class LatticeVal, class KeyInfo>
450void SparseSolver<LatticeKey, LatticeVal, KeyInfo>::visitInst(Instruction &I) {
451 // PHIs are handled by the propagation logic, they are never passed into the
452 // transfer functions.
453 if (PHINode *PN = dyn_cast<PHINode>(&I))
454 return visitPHINode(*PN);
455
456 // Otherwise, ask the transfer function what the result is. If this is
457 // something that we care about, remember it.
458 SmallDenseMap<LatticeKey, LatticeVal, 16> ChangedValues;
459 LatticeFunc->ComputeInstructionState(I, ChangedValues, *this);
460 for (auto &ChangedValue : ChangedValues)
461 if (ChangedValue.second != LatticeFunc->getUntrackedVal())
462 UpdateState(ChangedValue.first, ChangedValue.second);
463
464 if (I.isTerminator())
465 visitTerminator(I);
466}
467
468template <class LatticeKey, class LatticeVal, class KeyInfo>
470 // Process the work lists until they are empty!
471 while (!BBWorkList.empty() || !ValueWorkList.empty()) {
472 // Process the value work list.
473 while (!ValueWorkList.empty()) {
474 Value *V = ValueWorkList.pop_back_val();
475
476 LLVM_DEBUG(dbgs() << "\nPopped off V-WL: " << *V << "\n");
477
478 // "V" got into the work list because it made a transition. See if any
479 // users are both live and in need of updating.
480 for (User *U : V->users())
481 if (Instruction *Inst = dyn_cast<Instruction>(U))
482 if (BBExecutable.count(Inst->getParent())) // Inst is executable?
483 visitInst(*Inst);
484 }
485
486 // Process the basic block work list.
487 while (!BBWorkList.empty()) {
488 BasicBlock *BB = BBWorkList.pop_back_val();
489
490 LLVM_DEBUG(dbgs() << "\nPopped off BBWL: " << *BB);
491
492 // Notify all instructions in this basic block that they are newly
493 // executable.
494 for (Instruction &I : *BB)
495 visitInst(I);
496 }
497 }
498}
499
500template <class LatticeKey, class LatticeVal, class KeyInfo>
502 raw_ostream &OS) const {
503 if (ValueState.empty())
504 return;
505
506 LatticeKey Key;
507 LatticeVal LV;
508
509 OS << "ValueState:\n";
510 for (auto &Entry : ValueState) {
511 std::tie(Key, LV) = Entry;
512 if (LV == LatticeFunc->getUntrackedVal())
513 continue;
514 OS << "\t";
515 LatticeFunc->PrintLatticeVal(LV, OS);
516 OS << ": ";
517 LatticeFunc->PrintLatticeKey(Key, OS);
518 OS << "\n";
519 }
520}
521} // end namespace llvm
522
523#undef DEBUG_TYPE
524
525#endif // LLVM_ANALYSIS_SPARSEPROPAGATION_H
BlockVerifier::State From
This file contains the declarations for the subclasses of Constant, which represent the different fla...
#define LLVM_DEBUG(...)
Definition: Debug.h:106
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
#define I(x, y, z)
Definition: MD5.cpp:58
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
raw_pwrite_stream & OS
This file defines the SmallPtrSet class.
AbstractLatticeFunction - This class is implemented by the dataflow instance to specify what the latt...
LatticeVal getOverdefinedVal() const
AbstractLatticeFunction(LatticeVal undefVal, LatticeVal overdefinedVal, LatticeVal untrackedVal)
virtual void ComputeInstructionState(Instruction &I, SmallDenseMap< LatticeKey, LatticeVal, 16 > &ChangedValues, SparseSolver< LatticeKey, LatticeVal > &SS)=0
ComputeInstructionState - Compute the LatticeKeys that change as a result of executing instruction I.
virtual void PrintLatticeKey(LatticeKey Key, raw_ostream &OS)
PrintLatticeKey - Render the given LatticeKey to the specified stream.
virtual Value * GetValueFromLatticeVal(LatticeVal LV, Type *Ty=nullptr)
GetValueFromLatticeVal - If the given LatticeVal is representable as an LLVM value,...
virtual bool IsUntrackedValue(LatticeKey Key)
IsUntrackedValue - If the specified LatticeKey is obviously uninteresting to the analysis (i....
virtual void PrintLatticeVal(LatticeVal LV, raw_ostream &OS)
PrintLatticeVal - Render the given LatticeVal to the specified stream.
LatticeVal getUntrackedVal() const
virtual LatticeVal MergeValues(LatticeVal X, LatticeVal Y)
MergeValues - Compute and return the merge of the two specified lattice values.
virtual LatticeVal ComputeLatticeVal(LatticeKey Key)
ComputeLatticeVal - Compute and return a LatticeVal corresponding to the given LatticeKey.
virtual ~AbstractLatticeFunction()=default
virtual bool IsSpecialCasedPHI(PHINode *PN)
IsSpecialCasedPHI - Given a PHI node, determine whether this PHI node is one that the we want to hand...
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:448
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:177
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:156
iterator end()
Definition: DenseMap.h:84
unsigned getNumSuccessors() const LLVM_READONLY
Return the number of successors that this instruction has.
BasicBlock * getSuccessor(unsigned Idx) const LLVM_READONLY
Return the specified successor. This instruction must be a terminator.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition: SmallPtrSet.h:452
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:519
size_t size() const
Definition: SmallVector.h:78
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
SparseSolver - This class is a general purpose solver for Sparse Conditional Propagation with a progr...
bool isEdgeFeasible(BasicBlock *From, BasicBlock *To, bool AggressiveUndef=false)
isEdgeFeasible - Return true if the control flow edge from the 'From' basic block to the 'To' basic b...
void Print(raw_ostream &OS) const
LatticeVal getValueState(LatticeKey Key)
getValueState - Return the LatticeVal object corresponding to the given value from the ValueState map...
SparseSolver(AbstractLatticeFunction< LatticeKey, LatticeVal > *Lattice)
SparseSolver(const SparseSolver &)=delete
void MarkBlockExecutable(BasicBlock *BB)
MarkBlockExecutable - This method can be used by clients to mark all of the blocks that are known to ...
void Solve()
Solve - Solve for constants and executable blocks.
LatticeVal getExistingValueState(LatticeKey Key) const
getExistingValueState - Return the LatticeVal object corresponding to the given value from the ValueS...
bool isBlockExecutable(BasicBlock *BB) const
isBlockExecutable - Return true if there are any known feasible edges into the basic block.
SparseSolver & operator=(const SparseSolver &)=delete
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
const ParentTy * getParent() const
Definition: ilist_node.h:32
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
Key
PAL metadata keys.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
A template for translating between LLVM Values and LatticeKeys.