LLVM 19.0.0git
LoopDataPrefetch.cpp
Go to the documentation of this file.
1//===-------- LoopDataPrefetch.cpp - Loop Data Prefetching 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 file implements a Loop Data Prefetching Pass.
10//
11//===----------------------------------------------------------------------===//
12
15
17#include "llvm/ADT/Statistic.h"
25#include "llvm/IR/Dominators.h"
26#include "llvm/IR/Function.h"
27#include "llvm/IR/Module.h"
29#include "llvm/Support/Debug.h"
33
34#define DEBUG_TYPE "loop-data-prefetch"
35
36using namespace llvm;
37
38// By default, we limit this to creating 16 PHIs (which is a little over half
39// of the allocatable register set).
40static cl::opt<bool>
41PrefetchWrites("loop-prefetch-writes", cl::Hidden, cl::init(false),
42 cl::desc("Prefetch write addresses"));
43
45 PrefetchDistance("prefetch-distance",
46 cl::desc("Number of instructions to prefetch ahead"),
48
50 MinPrefetchStride("min-prefetch-stride",
51 cl::desc("Min stride to add prefetches"), cl::Hidden);
52
54 "max-prefetch-iters-ahead",
55 cl::desc("Max number of iterations to prefetch ahead"), cl::Hidden);
56
57STATISTIC(NumPrefetches, "Number of prefetches inserted");
58
59namespace {
60
61/// Loop prefetch implementation class.
62class LoopDataPrefetch {
63public:
64 LoopDataPrefetch(AssumptionCache *AC, DominatorTree *DT, LoopInfo *LI,
67 : AC(AC), DT(DT), LI(LI), SE(SE), TTI(TTI), ORE(ORE) {}
68
69 bool run();
70
71private:
72 bool runOnLoop(Loop *L);
73
74 /// Check if the stride of the accesses is large enough to
75 /// warrant a prefetch.
76 bool isStrideLargeEnough(const SCEVAddRecExpr *AR, unsigned TargetMinStride);
77
78 unsigned getMinPrefetchStride(unsigned NumMemAccesses,
79 unsigned NumStridedMemAccesses,
80 unsigned NumPrefetches,
81 bool HasCall) {
82 if (MinPrefetchStride.getNumOccurrences() > 0)
83 return MinPrefetchStride;
84 return TTI->getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
85 NumPrefetches, HasCall);
86 }
87
88 unsigned getPrefetchDistance() {
89 if (PrefetchDistance.getNumOccurrences() > 0)
90 return PrefetchDistance;
91 return TTI->getPrefetchDistance();
92 }
93
94 unsigned getMaxPrefetchIterationsAhead() {
95 if (MaxPrefetchIterationsAhead.getNumOccurrences() > 0)
98 }
99
100 bool doPrefetchWrites() {
101 if (PrefetchWrites.getNumOccurrences() > 0)
102 return PrefetchWrites;
103 return TTI->enableWritePrefetching();
104 }
105
106 AssumptionCache *AC;
107 DominatorTree *DT;
108 LoopInfo *LI;
109 ScalarEvolution *SE;
112};
113
114/// Legacy class for inserting loop data prefetches.
115class LoopDataPrefetchLegacyPass : public FunctionPass {
116public:
117 static char ID; // Pass ID, replacement for typeid
118 LoopDataPrefetchLegacyPass() : FunctionPass(ID) {
120 }
121
122 void getAnalysisUsage(AnalysisUsage &AU) const override {
134 }
135
136 bool runOnFunction(Function &F) override;
137 };
138}
139
140char LoopDataPrefetchLegacyPass::ID = 0;
141INITIALIZE_PASS_BEGIN(LoopDataPrefetchLegacyPass, "loop-data-prefetch",
142 "Loop Data Prefetch", false, false)
146INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
149INITIALIZE_PASS_END(LoopDataPrefetchLegacyPass, "loop-data-prefetch",
151
153 return new LoopDataPrefetchLegacyPass();
154}
155
156bool LoopDataPrefetch::isStrideLargeEnough(const SCEVAddRecExpr *AR,
157 unsigned TargetMinStride) {
158 // No need to check if any stride goes.
159 if (TargetMinStride <= 1)
160 return true;
161
162 const auto *ConstStride = dyn_cast<SCEVConstant>(AR->getStepRecurrence(*SE));
163 // If MinStride is set, don't prefetch unless we can ensure that stride is
164 // larger.
165 if (!ConstStride)
166 return false;
167
168 unsigned AbsStride = std::abs(ConstStride->getAPInt().getSExtValue());
169 return TargetMinStride <= AbsStride;
170}
171
175 LoopInfo *LI = &AM.getResult<LoopAnalysis>(F);
181
182 LoopDataPrefetch LDP(AC, DT, LI, SE, TTI, ORE);
183 bool Changed = LDP.run();
184
185 if (Changed) {
189 return PA;
190 }
191
192 return PreservedAnalyses::all();
193}
194
195bool LoopDataPrefetchLegacyPass::runOnFunction(Function &F) {
196 if (skipFunction(F))
197 return false;
198
199 DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
200 LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
201 ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
202 AssumptionCache *AC =
203 &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
205 &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE();
206 const TargetTransformInfo *TTI =
207 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
208
209 LoopDataPrefetch LDP(AC, DT, LI, SE, TTI, ORE);
210 return LDP.run();
211}
212
213bool LoopDataPrefetch::run() {
214 // If PrefetchDistance is not set, don't run the pass. This gives an
215 // opportunity for targets to run this pass for selected subtargets only
216 // (whose TTI sets PrefetchDistance and CacheLineSize).
217 if (getPrefetchDistance() == 0 || TTI->getCacheLineSize() == 0) {
218 LLVM_DEBUG(dbgs() << "Please set both PrefetchDistance and CacheLineSize "
219 "for loop data prefetch.\n");
220 return false;
221 }
222
223 bool MadeChange = false;
224
225 for (Loop *I : *LI)
226 for (Loop *L : depth_first(I))
227 MadeChange |= runOnLoop(L);
228
229 return MadeChange;
230}
231
232/// A record for a potential prefetch made during the initial scan of the
233/// loop. This is used to let a single prefetch target multiple memory accesses.
234struct Prefetch {
235 /// The address formula for this prefetch as returned by ScalarEvolution.
237 /// The point of insertion for the prefetch instruction.
238 Instruction *InsertPt = nullptr;
239 /// True if targeting a write memory access.
240 bool Writes = false;
241 /// The (first seen) prefetched instruction.
242 Instruction *MemI = nullptr;
243
244 /// Constructor to create a new Prefetch for \p I.
245 Prefetch(const SCEVAddRecExpr *L, Instruction *I) : LSCEVAddRec(L) {
246 addInstruction(I);
247 };
248
249 /// Add the instruction \param I to this prefetch. If it's not the first
250 /// one, 'InsertPt' and 'Writes' will be updated as required.
251 /// \param PtrDiff the known constant address difference to the first added
252 /// instruction.
254 int64_t PtrDiff = 0) {
255 if (!InsertPt) {
256 MemI = I;
257 InsertPt = I;
258 Writes = isa<StoreInst>(I);
259 } else {
260 BasicBlock *PrefBB = InsertPt->getParent();
261 BasicBlock *InsBB = I->getParent();
262 if (PrefBB != InsBB) {
263 BasicBlock *DomBB = DT->findNearestCommonDominator(PrefBB, InsBB);
264 if (DomBB != PrefBB)
265 InsertPt = DomBB->getTerminator();
266 }
267
268 if (isa<StoreInst>(I) && PtrDiff == 0)
269 Writes = true;
270 }
271 }
272};
273
274bool LoopDataPrefetch::runOnLoop(Loop *L) {
275 bool MadeChange = false;
276
277 // Only prefetch in the inner-most loop
278 if (!L->isInnermost())
279 return MadeChange;
280
282 CodeMetrics::collectEphemeralValues(L, AC, EphValues);
283
284 // Calculate the number of iterations ahead to prefetch
286 bool HasCall = false;
287 for (const auto BB : L->blocks()) {
288 // If the loop already has prefetches, then assume that the user knows
289 // what they are doing and don't add any more.
290 for (auto &I : *BB) {
291 if (isa<CallInst>(&I) || isa<InvokeInst>(&I)) {
292 if (const Function *F = cast<CallBase>(I).getCalledFunction()) {
293 if (F->getIntrinsicID() == Intrinsic::prefetch)
294 return MadeChange;
295 if (TTI->isLoweredToCall(F))
296 HasCall = true;
297 } else { // indirect call.
298 HasCall = true;
299 }
300 }
301 }
302 Metrics.analyzeBasicBlock(BB, *TTI, EphValues);
303 }
304
305 if (!Metrics.NumInsts.isValid())
306 return MadeChange;
307
308 unsigned LoopSize = *Metrics.NumInsts.getValue();
309 if (!LoopSize)
310 LoopSize = 1;
311
312 unsigned ItersAhead = getPrefetchDistance() / LoopSize;
313 if (!ItersAhead)
314 ItersAhead = 1;
315
316 if (ItersAhead > getMaxPrefetchIterationsAhead())
317 return MadeChange;
318
319 unsigned ConstantMaxTripCount = SE->getSmallConstantMaxTripCount(L);
320 if (ConstantMaxTripCount && ConstantMaxTripCount < ItersAhead + 1)
321 return MadeChange;
322
323 unsigned NumMemAccesses = 0;
324 unsigned NumStridedMemAccesses = 0;
325 SmallVector<Prefetch, 16> Prefetches;
326 for (const auto BB : L->blocks())
327 for (auto &I : *BB) {
328 Value *PtrValue;
329 Instruction *MemI;
330
331 if (LoadInst *LMemI = dyn_cast<LoadInst>(&I)) {
332 MemI = LMemI;
333 PtrValue = LMemI->getPointerOperand();
334 } else if (StoreInst *SMemI = dyn_cast<StoreInst>(&I)) {
335 if (!doPrefetchWrites()) continue;
336 MemI = SMemI;
337 PtrValue = SMemI->getPointerOperand();
338 } else continue;
339
340 unsigned PtrAddrSpace = PtrValue->getType()->getPointerAddressSpace();
341 if (!TTI->shouldPrefetchAddressSpace(PtrAddrSpace))
342 continue;
343 NumMemAccesses++;
344 if (L->isLoopInvariant(PtrValue))
345 continue;
346
347 const SCEV *LSCEV = SE->getSCEV(PtrValue);
348 const SCEVAddRecExpr *LSCEVAddRec = dyn_cast<SCEVAddRecExpr>(LSCEV);
349 if (!LSCEVAddRec)
350 continue;
351 NumStridedMemAccesses++;
352
353 // We don't want to double prefetch individual cache lines. If this
354 // access is known to be within one cache line of some other one that
355 // has already been prefetched, then don't prefetch this one as well.
356 bool DupPref = false;
357 for (auto &Pref : Prefetches) {
358 const SCEV *PtrDiff = SE->getMinusSCEV(LSCEVAddRec, Pref.LSCEVAddRec);
359 if (const SCEVConstant *ConstPtrDiff =
360 dyn_cast<SCEVConstant>(PtrDiff)) {
361 int64_t PD = std::abs(ConstPtrDiff->getValue()->getSExtValue());
362 if (PD < (int64_t) TTI->getCacheLineSize()) {
363 Pref.addInstruction(MemI, DT, PD);
364 DupPref = true;
365 break;
366 }
367 }
368 }
369 if (!DupPref)
370 Prefetches.push_back(Prefetch(LSCEVAddRec, MemI));
371 }
372
373 unsigned TargetMinStride =
374 getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
375 Prefetches.size(), HasCall);
376
377 LLVM_DEBUG(dbgs() << "Prefetching " << ItersAhead
378 << " iterations ahead (loop size: " << LoopSize << ") in "
379 << L->getHeader()->getParent()->getName() << ": " << *L);
380 LLVM_DEBUG(dbgs() << "Loop has: "
381 << NumMemAccesses << " memory accesses, "
382 << NumStridedMemAccesses << " strided memory accesses, "
383 << Prefetches.size() << " potential prefetch(es), "
384 << "a minimum stride of " << TargetMinStride << ", "
385 << (HasCall ? "calls" : "no calls") << ".\n");
386
387 for (auto &P : Prefetches) {
388 // Check if the stride of the accesses is large enough to warrant a
389 // prefetch.
390 if (!isStrideLargeEnough(P.LSCEVAddRec, TargetMinStride))
391 continue;
392
393 BasicBlock *BB = P.InsertPt->getParent();
394 SCEVExpander SCEVE(*SE, BB->getModule()->getDataLayout(), "prefaddr");
395 const SCEV *NextLSCEV = SE->getAddExpr(P.LSCEVAddRec, SE->getMulExpr(
396 SE->getConstant(P.LSCEVAddRec->getType(), ItersAhead),
397 P.LSCEVAddRec->getStepRecurrence(*SE)));
398 if (!SCEVE.isSafeToExpand(NextLSCEV))
399 continue;
400
401 unsigned PtrAddrSpace = NextLSCEV->getType()->getPointerAddressSpace();
402 Type *I8Ptr = PointerType::get(BB->getContext(), PtrAddrSpace);
403 Value *PrefPtrValue = SCEVE.expandCodeFor(NextLSCEV, I8Ptr, P.InsertPt);
404
405 IRBuilder<> Builder(P.InsertPt);
406 Module *M = BB->getParent()->getParent();
408 Function *PrefetchFunc = Intrinsic::getDeclaration(
409 M, Intrinsic::prefetch, PrefPtrValue->getType());
410 Builder.CreateCall(
411 PrefetchFunc,
412 {PrefPtrValue,
413 ConstantInt::get(I32, P.Writes),
414 ConstantInt::get(I32, 3), ConstantInt::get(I32, 1)});
415 ++NumPrefetches;
416 LLVM_DEBUG(dbgs() << " Access: "
417 << *P.MemI->getOperand(isa<LoadInst>(P.MemI) ? 0 : 1)
418 << ", SCEV: " << *P.LSCEVAddRec << "\n");
419 ORE->emit([&]() {
420 return OptimizationRemark(DEBUG_TYPE, "Prefetched", P.MemI)
421 << "prefetched memory access";
422 });
423
424 MadeChange = true;
425 }
426
427 return MadeChange;
428}
#define LLVM_DEBUG(X)
Definition: Debug.h:101
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
SmallVector< uint32_t, 0 > Writes
Definition: ELF_riscv.cpp:497
#define DEBUG_TYPE
static cl::opt< bool > PrefetchWrites("loop-prefetch-writes", cl::Hidden, cl::init(false), cl::desc("Prefetch write addresses"))
static cl::opt< unsigned > MinPrefetchStride("min-prefetch-stride", cl::desc("Min stride to add prefetches"), cl::Hidden)
static cl::opt< unsigned > PrefetchDistance("prefetch-distance", cl::desc("Number of instructions to prefetch ahead"), cl::Hidden)
static cl::opt< unsigned > MaxPrefetchIterationsAhead("max-prefetch-iters-ahead", cl::desc("Max number of iterations to prefetch ahead"), cl::Hidden)
loop data prefetch
This file provides the interface for LLVM's Loop Data Prefetching Pass.
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
Machine Trace Metrics
static const Function * getCalledFunction(const Value *V, bool &IsNoBuiltin)
Module.h This file contains the declarations for the Module class.
#define P(N)
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:55
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:59
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:52
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:167
This pass exposes codegen information to IR-level passes.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:321
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:473
Represent the analysis usage information of a pass.
AnalysisUsage & addRequiredID(const void *ID)
Definition: Pass.cpp:283
AnalysisUsage & addPreservedID(const void *ID)
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
A function analysis which provides an AssumptionCache.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:206
LLVMContext & getContext() const
Get the context in which this basic block lives.
Definition: BasicBlock.cpp:168
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Definition: BasicBlock.h:221
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
Definition: BasicBlock.cpp:289
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:279
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:317
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:162
Instruction * findNearestCommonDominator(Instruction *I1, Instruction *I2) const
Find the nearest instruction I that dominates both I1 and I2, in the sense that a result produced bef...
Definition: Dominators.cpp:344
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:311
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:655
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2667
const BasicBlock * getParent() const
Definition: Instruction.h:152
An instruction for reading from memory.
Definition: Instructions.h:184
Analysis pass that exposes the LoopInfo for a function.
Definition: LoopInfo.h:566
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
The legacy pass manager's analysis pass to compute loop information.
Definition: LoopInfo.h:593
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:44
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.h:293
OptimizationRemarkEmitter legacy analysis pass.
The optimization diagnostic interface.
void emit(DiagnosticInfoOptimizationBase &OptDiag)
Output the remark via the diagnostic handler and to the optimization record file.
Diagnostic information for applied optimization remarks.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:98
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:109
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:115
void preserve()
Mark an analysis as preserved.
Definition: Analysis.h:129
This node represents a polynomial recurrence on the trip count of the specified loop.
const SCEV * getStepRecurrence(ScalarEvolution &SE) const
Constructs and returns the recurrence indicating how much this expression steps by.
This class represents a constant integer value.
This class uses information about analyze scalars to rewrite expressions in canonical form.
This class represents an analyzed expression in the program.
Type * getType() const
Return the LLVM type of this SCEV expression.
Analysis pass that exposes the ScalarEvolution for a function.
The main scalar evolution driver.
const SCEV * getConstant(ConstantInt *V)
const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
unsigned getSmallConstantMaxTripCount(const Loop *L)
Returns the upper bound of the loop trip count as a normal unsigned value.
const SCEV * getMinusSCEV(const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS.
const SCEV * getMulExpr(SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical multiply expression, or something simpler if possible.
const SCEV * getAddExpr(SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:427
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
An instruction for storing to memory.
Definition: Instructions.h:317
Analysis pass providing the TargetTransformInfo.
Wrapper pass for TargetTransformInfo.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
unsigned getMaxPrefetchIterationsAhead() const
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const
Some HW prefetchers can handle accesses up to a certain constant stride.
bool shouldPrefetchAddressSpace(unsigned AS) const
bool isLoweredToCall(const Function *F) const
Test whether calls to a function lower to actual program function calls.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM Value Representation.
Definition: Value.h:74
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1469
@ PD
PD - Prefix code for packed double precision vector floating point operations performed in the SSE re...
Definition: X86BaseInfo.h:735
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:450
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
char & LoopSimplifyID
void initializeLoopDataPrefetchLegacyPassPass(PassRegistry &)
FunctionPass * createLoopDataPrefetchPass()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
iterator_range< df_iterator< T > > depth_first(const T &G)
A record for a potential prefetch made during the initial scan of the loop.
void addInstruction(Instruction *I, DominatorTree *DT=nullptr, int64_t PtrDiff=0)
Add the instruction.
const SCEVAddRecExpr * LSCEVAddRec
The address formula for this prefetch as returned by ScalarEvolution.
Prefetch(const SCEVAddRecExpr *L, Instruction *I)
Constructor to create a new Prefetch for I.
Utility to calculate the size and a few similar metrics for a set of basic blocks.
Definition: CodeMetrics.h:31
static void collectEphemeralValues(const Loop *L, AssumptionCache *AC, SmallPtrSetImpl< const Value * > &EphValues)
Collect a loop's ephemeral values (those used only by an assume or similar intrinsics in the loop).
Definition: CodeMetrics.cpp:70