LLVM 24.0.0git
LoopSink.cpp
Go to the documentation of this file.
1//===-- LoopSink.cpp - Loop Sink Pass -------------------------------------===//
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 pass does the inverse transformation of what LICM does.
10// It traverses all of the instructions in the loop's preheader and sinks
11// them to the loop body where frequency is lower than the loop's preheader.
12// This pass is a reverse-transformation of LICM. It differs from the Sink
13// pass in the following ways:
14//
15// * It only handles sinking of instructions from the loop's preheader to the
16// loop's body
17// * It uses alias set tracker to get more accurate alias info
18// * It uses block frequency info to find the optimal sinking locations
19//
20// Overall algorithm:
21//
22// For I in Preheader:
23// InsertBBs = BBs that uses I
24// For BB in sorted(LoopBBs):
25// DomBBs = BBs in InsertBBs that are dominated by BB
26// if freq(DomBBs) > freq(BB)
27// InsertBBs = UseBBs - DomBBs + BB
28// For BB in InsertBBs:
29// Insert I at BB's beginning
30//
31//===----------------------------------------------------------------------===//
32
34#include "ScalarOptions.h"
36#include "llvm/ADT/Statistic.h"
43#include "llvm/IR/Dominators.h"
49using namespace llvm;
50
51#define DEBUG_TYPE "loopsink"
52
53STATISTIC(NumLoopSunk, "Number of instructions sunk into loop");
54STATISTIC(NumLoopSunkCloned, "Number of cloned instructions sunk into loop");
55
56/// Return adjusted total frequency of \p BBs.
57///
58/// * If there is only one BB, sinking instruction will not introduce code
59/// size increase. Thus there is no need to adjust the frequency.
60/// * If there are more than one BB, sinking would lead to code size increase.
61/// In this case, we add some "tax" to the total frequency to make it harder
62/// to sink. E.g.
63/// Freq(Preheader) = 100
64/// Freq(BBs) = sum(50, 49) = 99
65/// Even if Freq(BBs) < Freq(Preheader), we will not sink from Preheade to
66/// BBs as the difference is too small to justify the code size increase.
67/// To model this, The adjusted Freq(BBs) will be:
68/// AdjustedFreq(BBs) = 99 / SinkFrequencyPercentThreshold%
69static BlockFrequency adjustedSumFreq(const ScalarOptions &Opts,
71 BlockFrequencyInfo &BFI) {
73 for (BasicBlock *B : BBs)
74 T += BFI.getBlockFreq(B);
75 if (BBs.size() > 1)
76 T /= BranchProbability(Opts.sink_freq_percent_threshold, 100);
77 return T;
78}
79
80/// Return a set of basic blocks to insert sinked instructions.
81///
82/// The returned set of basic blocks (BBsToSinkInto) should satisfy:
83///
84/// * Inside the loop \p L
85/// * For each UseBB in \p UseBBs, there is at least one BB in BBsToSinkInto
86/// that domintates the UseBB
87/// * Has minimum total frequency that is no greater than preheader frequency
88///
89/// The purpose of the function is to find the optimal sinking points to
90/// minimize execution cost, which is defined as "sum of frequency of
91/// BBsToSinkInto".
92/// As a result, the returned BBsToSinkInto needs to have minimum total
93/// frequency.
94/// Additionally, if the total frequency of BBsToSinkInto exceeds preheader
95/// frequency, the optimal solution is not sinking (return empty set).
96///
97/// \p ColdLoopBBs is used to help find the optimal sinking locations.
98/// It stores a list of BBs that is:
99///
100/// * Inside the loop \p L
101/// * Has a frequency no larger than the loop's preheader
102/// * Sorted by BB frequency
103///
104/// The complexity of the function is O(UseBBs.size() * ColdLoopBBs.size()).
105/// To avoid expensive computation, we cap the maximum UseBBs.size() in its
106/// caller.
108findBBsToSinkInto(const ScalarOptions &Opts, const Loop &L,
109 const SmallPtrSetImpl<BasicBlock *> &UseBBs,
110 const SmallVectorImpl<BasicBlock *> &ColdLoopBBs,
112 SmallPtrSet<BasicBlock *, 2> BBsToSinkInto;
113 if (UseBBs.size() == 0)
114 return BBsToSinkInto;
115
116 BBsToSinkInto.insert_range(UseBBs);
117 SmallPtrSet<BasicBlock *, 2> BBsDominatedByColdestBB;
118
119 // For every iteration:
120 // * Pick the ColdestBB from ColdLoopBBs
121 // * Find the set BBsDominatedByColdestBB that satisfy:
122 // - BBsDominatedByColdestBB is a subset of BBsToSinkInto
123 // - Every BB in BBsDominatedByColdestBB is dominated by ColdestBB
124 // * If Freq(ColdestBB) < Freq(BBsDominatedByColdestBB), remove
125 // BBsDominatedByColdestBB from BBsToSinkInto, add ColdestBB to
126 // BBsToSinkInto
127 for (BasicBlock *ColdestBB : ColdLoopBBs) {
128 BBsDominatedByColdestBB.clear();
129 for (BasicBlock *SinkedBB : BBsToSinkInto)
130 if (DT.dominates(ColdestBB, SinkedBB))
131 BBsDominatedByColdestBB.insert(SinkedBB);
132 if (BBsDominatedByColdestBB.size() == 0)
133 continue;
134 if (adjustedSumFreq(Opts, BBsDominatedByColdestBB, BFI) >
135 BFI.getBlockFreq(ColdestBB)) {
136 for (BasicBlock *DominatedBB : BBsDominatedByColdestBB) {
137 BBsToSinkInto.erase(DominatedBB);
138 }
139 BBsToSinkInto.insert(ColdestBB);
140 continue;
141 }
142 // Otherwise, see if we can stop the search through the cold BBs early.
143 // Since the ColdLoopBBs list is sorted in increasing magnitude of
144 // frequency the cold BB frequencies can only get larger. The
145 // BBsToSinkInto set can only get smaller and have a smaller
146 // adjustedSumFreq, due to the earlier checking. So once we find a cold BB
147 // with a frequency at least as large as the adjustedSumFreq of the
148 // current BBsToSinkInto set, the earlier frequency check can never be
149 // true for a future iteration. Note we could do check this more
150 // aggressively earlier, but in practice this ended up being more
151 // expensive overall (added checking to the critical path through the loop
152 // that often ended up continuing early due to an empty
153 // BBsDominatedByColdestBB set, and the frequency check there was false
154 // most of the time anyway).
155 if (adjustedSumFreq(Opts, BBsToSinkInto, BFI) <=
156 BFI.getBlockFreq(ColdestBB))
157 break;
158 }
159
160 // Can't sink into blocks that have no valid insertion point.
161 for (BasicBlock *BB : BBsToSinkInto) {
162 if (BB->getFirstInsertionPt() == BB->end()) {
163 BBsToSinkInto.clear();
164 break;
165 }
166 }
167
168 // If the total frequency of BBsToSinkInto is larger than preheader frequency,
169 // do not sink.
170 if (adjustedSumFreq(Opts, BBsToSinkInto, BFI) >
171 BFI.getBlockFreq(L.getLoopPreheader()))
172 BBsToSinkInto.clear();
173 return BBsToSinkInto;
174}
175
176// Sinks \p I from the loop \p L's preheader to its uses. Returns true if
177// sinking is successful.
178// \p LoopBlockNumber is used to sort the insertion blocks to ensure
179// determinism.
180static bool
181sinkInstruction(const ScalarOptions &Opts, Loop &L, Instruction &I,
182 const SmallVectorImpl<BasicBlock *> &ColdLoopBBs,
183 const SmallDenseMap<BasicBlock *, int, 16> &LoopBlockNumber,
185 MemorySSAUpdater *MSSAU) {
186 // Compute the set of blocks in loop L which contain a use of I.
188 for (auto &U : I.uses()) {
189 Instruction *UI = cast<Instruction>(U.getUser());
190
191 // We cannot sink I if it has uses outside of the loop.
192 if (!L.contains(LI.getLoopFor(UI->getParent())))
193 return false;
194
195 if (!isa<PHINode>(UI)) {
196 BBs.insert(UI->getParent());
197 continue;
198 }
199
200 // We cannot sink I to PHI-uses, try to look through PHI to find the incoming
201 // block of the value being used.
202 PHINode *PN = dyn_cast<PHINode>(UI);
203 BasicBlock *PhiBB = PN->getIncomingBlock(U);
204
205 // If value's incoming block is from loop preheader directly, there's no
206 // place to sink to, bailout.
207 if (L.getLoopPreheader() == PhiBB)
208 return false;
209
210 BBs.insert(PhiBB);
211 }
212
213 // findBBsToSinkInto is O(BBs.size() * ColdLoopBBs.size()). We cap the max
214 // BBs.size() to avoid expensive computation.
215 // FIXME: Handle code size growth for min_size and opt_size.
216 if (BBs.size() > Opts.max_uses_for_sinking)
217 return false;
218
219 // Find the set of BBs that we should insert a copy of I.
220 SmallPtrSet<BasicBlock *, 2> BBsToSinkInto =
221 findBBsToSinkInto(Opts, L, BBs, ColdLoopBBs, DT, BFI);
222 if (BBsToSinkInto.empty())
223 return false;
224
225 // Return if any of the candidate blocks to sink into is non-cold.
226 if (BBsToSinkInto.size() > 1 &&
227 !llvm::set_is_subset(BBsToSinkInto, LoopBlockNumber))
228 return false;
229
230 // Copy the final BBs into a vector and sort them using the total ordering
231 // of the loop block numbers as iterating the set doesn't give a useful
232 // order. No need to stable sort as the block numbers are a total ordering.
233 SmallVector<BasicBlock *, 2> SortedBBsToSinkInto;
234 llvm::append_range(SortedBBsToSinkInto, BBsToSinkInto);
235 if (SortedBBsToSinkInto.size() > 1) {
236 llvm::sort(SortedBBsToSinkInto, [&](BasicBlock *A, BasicBlock *B) {
237 return LoopBlockNumber.find(A)->second < LoopBlockNumber.find(B)->second;
238 });
239 }
240
241 BasicBlock *MoveBB = *SortedBBsToSinkInto.begin();
242 // FIXME: Optimize the efficiency for cloned value replacement. The current
243 // implementation is O(SortedBBsToSinkInto.size() * I.num_uses()).
244 for (BasicBlock *N : ArrayRef(SortedBBsToSinkInto).drop_front(1)) {
245 assert(LoopBlockNumber.find(N)->second >
246 LoopBlockNumber.find(MoveBB)->second &&
247 "BBs not sorted!");
248 // Clone I and replace its uses.
249 Instruction *IC = I.clone();
250 IC->setName(I.getName());
251 IC->insertBefore(N->getFirstInsertionPt());
252
253 if (MSSAU && MSSAU->getMemorySSA()->getMemoryAccess(&I)) {
254 // Create a new MemoryAccess and let MemorySSA set its defining access.
255 MemoryAccess *NewMemAcc =
256 MSSAU->createMemoryAccessInBB(IC, nullptr, N, MemorySSA::Beginning);
257 if (NewMemAcc) {
258 if (auto *MemDef = dyn_cast<MemoryDef>(NewMemAcc))
259 MSSAU->insertDef(MemDef, /*RenameUses=*/true);
260 else {
261 auto *MemUse = cast<MemoryUse>(NewMemAcc);
262 MSSAU->insertUse(MemUse, /*RenameUses=*/true);
263 }
264 }
265 }
266
267 // Replaces uses of I with IC in N, except PHI-use which is being taken
268 // care of by defs in PHI's incoming blocks.
269 I.replaceUsesWithIf(IC, [N](Use &U) {
270 Instruction *UIToReplace = cast<Instruction>(U.getUser());
271 return UIToReplace->getParent() == N && !isa<PHINode>(UIToReplace);
272 });
273 // Replaces uses of I with IC in blocks dominated by N
274 replaceDominatedUsesWith(&I, IC, DT, N);
275 LLVM_DEBUG(dbgs() << "Sinking a clone of " << I << " To: " << N->getName()
276 << '\n');
277 NumLoopSunkCloned++;
278 }
279 LLVM_DEBUG(dbgs() << "Sinking " << I << " To: " << MoveBB->getName() << '\n');
280 NumLoopSunk++;
281 I.moveBefore(MoveBB->getFirstInsertionPt());
282
283 if (MSSAU)
285 MSSAU->getMemorySSA()->getMemoryAccess(&I)))
286 MSSAU->moveToPlace(OldMemAcc, MoveBB, MemorySSA::Beginning);
287
288 return true;
289}
290
291/// Sinks instructions from loop's preheader to the loop body if the
292/// sum frequency of inserted copy is smaller than preheader's frequency.
294 DominatorTree &DT,
296 MemorySSA &MSSA,
297 ScalarEvolution *SE) {
298 const ScalarOptions &Opts = ScalarOptions::Global;
299 BasicBlock *Preheader = L.getLoopPreheader();
300 assert(Preheader && "Expected loop to have preheader");
301
302 assert(Preheader->getParent()->hasProfileData() &&
303 "Unexpected call when profile data unavailable.");
304
305 const BlockFrequency PreheaderFreq = BFI.getBlockFreq(Preheader);
306 // If there are no basic blocks with lower frequency than the preheader then
307 // we can avoid the detailed analysis as we will never find profitable sinking
308 // opportunities.
309 if (all_of(L.blocks(), [&](const BasicBlock *BB) {
310 return BFI.getBlockFreq(BB) > PreheaderFreq;
311 }))
312 return false;
313
314 MemorySSAUpdater MSSAU(&MSSA);
315 SinkAndHoistLICMFlags LICMFlags(/*IsSink=*/true, L, MSSA);
316
317 bool Changed = false;
318
319 // Sort loop's basic blocks by frequency
322 int i = 0;
323 for (BasicBlock *B : L.blocks())
324 if (BFI.getBlockFreq(B) < BFI.getBlockFreq(L.getLoopPreheader())) {
325 ColdLoopBBs.push_back(B);
326 LoopBlockNumber[B] = ++i;
327 }
328 llvm::stable_sort(ColdLoopBBs, [&](BasicBlock *A, BasicBlock *B) {
329 return BFI.getBlockFreq(A) < BFI.getBlockFreq(B);
330 });
331
332 // Traverse preheader's instructions in reverse order because if A depends
333 // on B (A appears after B), A needs to be sunk first before B can be
334 // sinked.
336 if (isa<PHINode>(&I))
337 continue;
338 // No need to check for instruction's operands are loop invariant.
339 assert(L.hasLoopInvariantOperands(&I) &&
340 "Insts in a loop's preheader should have loop invariant operands!");
341 if (!canSinkOrHoistInst(I, &AA, &DT, &L, MSSAU, false, LICMFlags))
342 continue;
343 if (sinkInstruction(Opts, L, I, ColdLoopBBs, LoopBlockNumber, LI, DT, BFI,
344 &MSSAU)) {
345 Changed = true;
346 if (SE)
348 }
349 }
350
351 return Changed;
352}
353
355 // Enable LoopSink only when runtime profile is available.
356 // With static profile, the sinking decision may be sub-optimal.
357 if (!F.hasProfileData())
358 return PreservedAnalyses::all();
359
360 LoopInfo &LI = FAM.getResult<LoopAnalysis>(F);
361 // Nothing to do if there are no loops.
362 if (LI.empty())
363 return PreservedAnalyses::all();
364
365 AAResults &AA = FAM.getResult<AAManager>(F);
366 DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
368 MemorySSA &MSSA = FAM.getResult<MemorySSAAnalysis>(F).getMSSA();
369
370 // We want to do a postorder walk over the loops. Since loops are a tree this
371 // is equivalent to a reversed preorder walk and preorder is easy to compute
372 // without recursion. Since we reverse the preorder, we will visit siblings
373 // in reverse program order. This isn't expected to matter at all but is more
374 // consistent with sinking algorithms which generally work bottom-up.
375 SmallVector<Loop *, 4> PreorderLoops = LI.getLoopsInPreorder();
376
377 bool Changed = false;
378 do {
379 Loop &L = *PreorderLoops.pop_back_val();
380
381 BasicBlock *Preheader = L.getLoopPreheader();
382 if (!Preheader)
383 continue;
384
385 // Note that we don't pass SCEV here because it is only used to invalidate
386 // loops in SCEV and we don't preserve (or request) SCEV at all making that
387 // unnecessary.
388 Changed |= sinkLoopInvariantInstructions(L, AA, LI, DT, BFI, MSSA,
389 /*ScalarEvolution*/ nullptr);
390 } while (!PreorderLoops.empty());
391
392 if (!Changed)
393 return PreservedAnalyses::all();
394
398
399 if (VerifyMemorySSA)
400 MSSA.verifyMemorySSA();
401
402 return PA;
403}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static SmallPtrSet< BasicBlock *, 2 > findBBsToSinkInto(const ScalarOptions &Opts, const Loop &L, const SmallPtrSetImpl< BasicBlock * > &UseBBs, const SmallVectorImpl< BasicBlock * > &ColdLoopBBs, DominatorTree &DT, BlockFrequencyInfo &BFI)
Return a set of basic blocks to insert sinked instructions.
Definition LoopSink.cpp:108
static bool sinkLoopInvariantInstructions(Loop &L, AAResults &AA, LoopInfo &LI, DominatorTree &DT, BlockFrequencyInfo &BFI, MemorySSA &MSSA, ScalarEvolution *SE)
Sinks instructions from loop's preheader to the loop body if the sum frequency of inserted copy is sm...
Definition LoopSink.cpp:293
static bool sinkInstruction(const ScalarOptions &Opts, Loop &L, Instruction &I, const SmallVectorImpl< BasicBlock * > &ColdLoopBBs, const SmallDenseMap< BasicBlock *, int, 16 > &LoopBlockNumber, LoopInfo &LI, DominatorTree &DT, BlockFrequencyInfo &BFI, MemorySSAUpdater *MSSAU)
Definition LoopSink.cpp:181
static BlockFrequency adjustedSumFreq(const ScalarOptions &Opts, SmallPtrSetImpl< BasicBlock * > &BBs, BlockFrequencyInfo &BFI)
Return adjusted total frequency of BBs.
Definition LoopSink.cpp:69
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
#define T
FunctionAnalysisManager FAM
This file defines generic set operations that may be used on set's of different types,...
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Definition Statistic.h:171
#define LLVM_DEBUG(...)
Definition Debug.h:119
A manager for alias analyses.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
LLVM_ABI const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
const Function * getParent() const
Return the enclosing method, or null if none.
Definition BasicBlock.h:213
Analysis pass which computes BlockFrequencyInfo.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
LLVM_ABI BlockFrequency getBlockFreq(const BasicBlock *BB) const
getblockFreq - Return block frequency.
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
iterator find(const_arg_type_t< KeyT > Val)
Definition DenseMap.h:767
Analysis pass which computes a DominatorTree.
Definition Dominators.h:241
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:122
LLVM_ABI bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
bool hasProfileData() const
Return true if the function is annotated with profile data.
Definition Function.h:313
LLVM_ABI void insertBefore(InstListType::iterator InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified position.
Analysis pass that exposes the LoopInfo for a function.
Definition LoopInfo.h:594
SmallVector< LoopT *, 4 > getLoopsInPreorder() const
Return all of the loops in the function in preorder across the loop nests, with siblings in forward p...
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Definition LoopSink.cpp:354
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
An analysis that produces MemorySSA for a function.
Definition MemorySSA.h:922
MemorySSA * getMemorySSA() const
Get handle on MemorySSA.
LLVM_ABI void insertDef(MemoryDef *Def, bool RenameUses=false)
Insert a definition into the MemorySSA IR.
LLVM_ABI void insertUse(MemoryUse *Use, bool RenameUses=false)
LLVM_ABI MemoryAccess * createMemoryAccessInBB(Instruction *I, MemoryAccess *Definition, const BasicBlock *BB, MemorySSA::InsertionPlace Point, bool CreationMustSucceed=true)
Create a MemoryAccess in MemorySSA at a specified point in a block.
LLVM_ABI void moveToPlace(MemoryUseOrDef *What, BasicBlock *BB, MemorySSA::InsertionPlace Where)
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition MemorySSA.h:702
MemoryUseOrDef * getMemoryAccess(const Instruction *I) const
Given a memory Mod/Ref'ing instruction, get the MemorySSA access associated with it.
Definition MemorySSA.h:720
Class that has the common methods + fields of memory uses/defs.
Definition MemorySSA.h:250
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Definition Analysis.h:151
PreservedAnalyses & preserve()
Mark an analysis as preserved.
Definition Analysis.h:132
The main scalar evolution driver.
LLVM_ABI void forgetBlockAndLoopDispositions(Value *V=nullptr)
Called when the client has changed the disposition of values in a loop or block.
Flags controlling how much is checked when sinking or hoisting instructions.
Definition LoopUtils.h:123
size_type size() const
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
void insert_range(Range &&R)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A Use represents the edge between a Value definition and its users.
Definition Use.h:35
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
Definition Value.cpp:394
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Definition Value.cpp:319
const ParentTy * getParent() const
Definition ilist_node.h:34
Changed
Abstract Attribute helper functions.
Definition Attributor.h:165
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
Definition STLExtras.h:2132
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1755
LLVM_ABI bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT, Loop *CurLoop, MemorySSAUpdater &MSSAU, bool TargetExecutesOncePerLoop, SinkAndHoistLICMFlags &LICMFlags, OptimizationRemarkEmitter *ORE=nullptr)
Returns true if is legal to hoist or sink this instruction disregarding the possible introduction of ...
Definition LICM.cpp:957
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
bool set_is_subset(const S1Ty &S1, const S2Ty &S2)
set_is_subset(A, B) - Return true iff A in B
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2224
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition STLExtras.h:649
auto cast_or_null(const Y &Val)
Definition Casting.h:714
auto reverse(ContainerTy &&C)
Definition STLExtras.h:408
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1652
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
LLVM_ABI unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT, const BasicBlockEdge &Edge)
Replace each use of 'From' with 'To' if that use is dominated by the given edge.
Definition Local.cpp:3277
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ABI bool VerifyMemorySSA
Enables verification of MemorySSA.
Definition MemorySSA.cpp:85
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
#define N