LLVM 24.0.0git
AMDGPULowerKernelArguments.cpp
Go to the documentation of this file.
1//===-- AMDGPULowerKernelArguments.cpp ------------------------------------------===//
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/// \file This pass replaces accesses to kernel arguments with loads from
10/// offsets from the kernarg base pointer.
11//
12//===----------------------------------------------------------------------===//
13
14#include "AMDGPU.h"
15#include "GCNSubtarget.h"
21#include "llvm/IR/Argument.h"
22#include "llvm/IR/Attributes.h"
23#include "llvm/IR/Dominators.h"
24#include "llvm/IR/IRBuilder.h"
26#include "llvm/IR/Instruction.h"
28#include "llvm/IR/IntrinsicsAMDGPU.h"
29#include "llvm/IR/LLVMContext.h"
30#include "llvm/IR/MDBuilder.h"
32#include <optional>
33
34#define DEBUG_TYPE "amdgpu-lower-kernel-arguments"
35
36using namespace llvm;
37
38namespace {
39
40class AMDGPULowerKernelArguments : public FunctionPass {
41public:
42 static char ID;
43
44 AMDGPULowerKernelArguments() : FunctionPass(ID) {}
45
46 bool runOnFunction(Function &F) override;
47
48 void getAnalysisUsage(AnalysisUsage &AU) const override {
51 AU.setPreservesAll();
52 }
53};
54
55} // end anonymous namespace
56
57// skip allocas
60 for (BasicBlock::iterator E = BB.end(); InsPt != E; ++InsPt) {
61 AllocaInst *AI = dyn_cast<AllocaInst>(&*InsPt);
62
63 // If this is a dynamic alloca, the value may depend on the loaded kernargs,
64 // so loads will need to be inserted before it.
65 if (!AI || !AI->isStaticAlloca())
66 break;
67 }
68
69 return InsPt;
70}
71
73 DominatorTree &DT) {
74 // Collect noalias arguments.
76
77 for (Argument &Arg : F.args())
78 if (Arg.hasNoAliasAttr() && !Arg.use_empty())
79 NoAliasArgs.push_back(&Arg);
80
81 if (NoAliasArgs.empty())
82 return;
83
84 // Add alias scopes for each noalias argument.
85 MDBuilder MDB(F.getContext());
87 MDNode *NewDomain = MDB.createAnonymousAliasScopeDomain(F.getName());
88
89 for (unsigned I = 0u; I < NoAliasArgs.size(); ++I) {
90 const Argument *Arg = NoAliasArgs[I];
91 MDNode *NewScope = MDB.createAnonymousAliasScope(NewDomain, Arg->getName());
92 NewScopes.insert({Arg, NewScope});
93 }
94
95 // Iterate over all instructions.
96 for (inst_iterator Inst = inst_begin(F), InstEnd = inst_end(F);
97 Inst != InstEnd; ++Inst) {
98 // If instruction accesses memory, collect its pointer arguments.
99 Instruction *I = &(*Inst);
101 // May reach a noalias argument via a copy captured before the call.
102 bool IsUnrestrictedCall = false;
103
104 if (std::optional<MemoryLocation> MO = MemoryLocation::getOrNone(I))
105 PtrArgs.push_back(MO->Ptr);
106 else if (const CallBase *Call = dyn_cast<CallBase>(I)) {
107 MemoryEffects ME = Call->getMemoryEffects();
108 if (ME.doesNotAccessMemory())
109 continue;
110
111 // Inaccessible memory cannot alias any IR-visible pointer.
113 continue;
114 IsUnrestrictedCall = !ME.onlyAccessesArgPointees();
115
116 for (Value *Arg : Call->args()) {
117 if (!Arg->getType()->isPointerTy())
118 continue;
119
120 PtrArgs.push_back(Arg);
121 }
122 } else {
123 // Not a memory access and not a call — nothing to annotate.
124 continue;
125 }
126
127 // Collect underlying objects of pointer arguments.
131
132 for (const Value *Val : PtrArgs) {
134 getUnderlyingObjects(Val, Objects);
135 ObjSet.insert_range(Objects);
136 }
137
138 bool RequiresNoCaptureBefore = false;
139 bool UsesUnknownObject = false;
140 bool UsesAliasingPtr = false;
141
142 for (const Value *Val : ObjSet) {
143 if (isa<ConstantData>(Val))
144 continue;
145
146 if (const Argument *Arg = dyn_cast<Argument>(Val)) {
147 if (!Arg->hasAttribute(Attribute::NoAlias))
148 UsesAliasingPtr = true;
149 } else
150 UsesAliasingPtr = true;
151
152 if (isEscapeSource(Val)) {
153 // Can only alias a noalias argument if captured beforehand.
154 RequiresNoCaptureBefore = true;
155 } else if (!isa<Argument>(Val) && !isIdentifiedObject(Val)) {
156 // Unknown provenance: assume nothing.
157 UsesUnknownObject = true;
158 }
159 }
160
161 if (UsesUnknownObject)
162 continue;
163
164 if (IsUnrestrictedCall)
165 RequiresNoCaptureBefore = true;
166
167 // Collect noalias scopes for instruction.
168 for (const Argument *Arg : NoAliasArgs) {
169 if (ObjSet.contains(Arg))
170 continue;
171
172 if (!RequiresNoCaptureBefore ||
174 Arg, false, I, &DT, false, CaptureComponents::Provenance)))
175 NoAliases.push_back(NewScopes[Arg]);
176 }
177
178 // Collect scopes for alias.scope metadata. Skip unrestricted calls: they
179 // may touch memory beyond their pointer arguments' pointees.
180 if (!UsesAliasingPtr && !IsUnrestrictedCall)
181 for (const Argument *Arg : NoAliasArgs) {
182 if (ObjSet.count(Arg))
183 Scopes.push_back(NewScopes[Arg]);
184 }
185
186 // Add noalias metadata to instruction.
187 if (!NoAliases.empty()) {
188 MDNode *NewMD =
189 MDNode::concatenate(Inst->getMetadata(LLVMContext::MD_noalias),
190 MDNode::get(F.getContext(), NoAliases));
191 Inst->setMetadata(LLVMContext::MD_noalias, NewMD);
192 }
193
194 // Add alias.scope metadata to instruction.
195 if (!Scopes.empty()) {
196 MDNode *NewMD =
197 MDNode::concatenate(Inst->getMetadata(LLVMContext::MD_alias_scope),
198 MDNode::get(F.getContext(), Scopes));
199 Inst->setMetadata(LLVMContext::MD_alias_scope, NewMD);
200 }
201 }
202}
203
205 DominatorTree &DT) {
206 CallingConv::ID CC = F.getCallingConv();
207 if (CC != CallingConv::AMDGPU_KERNEL || F.arg_empty())
208 return false;
209
210 const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
211 LLVMContext &Ctx = F.getContext();
212 const DataLayout &DL = F.getDataLayout();
213 BasicBlock &EntryBlock = *F.begin();
214 IRBuilder<> Builder(&EntryBlock, getInsertPt(EntryBlock));
215
216 const Align KernArgBaseAlign(16); // FIXME: Increase if necessary
217 const uint64_t BaseOffset = ST.getExplicitKernelArgOffset();
218
219 Align MaxAlign;
220 // FIXME: Alignment is broken with explicit arg offset.;
221 const uint64_t TotalKernArgSize = ST.getKernArgSegmentSize(F, MaxAlign);
222 if (TotalKernArgSize == 0)
223 return false;
224
225 CallInst *KernArgSegment = Builder.CreateIntrinsicWithoutFolding(
226 Intrinsic::amdgcn_kernarg_segment_ptr, {}, nullptr,
227 F.getName() + ".kernarg.segment");
228 KernArgSegment->addRetAttr(Attribute::NonNull);
229 KernArgSegment->addRetAttr(
230 Attribute::getWithDereferenceableBytes(Ctx, TotalKernArgSize));
231
232 uint64_t ExplicitArgOffset = 0;
233
234 addAliasScopeMetadata(F, F.getParent()->getDataLayout(), DT);
235
236 for (Argument &Arg : F.args()) {
237 const bool IsByRef = Arg.hasByRefAttr();
238 Type *ArgTy = IsByRef ? Arg.getParamByRefType() : Arg.getType();
239 MaybeAlign ParamAlign = IsByRef ? Arg.getParamAlign() : std::nullopt;
240 Align ABITypeAlign = DL.getValueOrABITypeAlignment(ParamAlign, ArgTy);
241
242 uint64_t Size = DL.getTypeSizeInBits(ArgTy);
243 uint64_t AllocSize = DL.getTypeAllocSize(ArgTy);
244
245 uint64_t EltOffset = alignTo(ExplicitArgOffset, ABITypeAlign) + BaseOffset;
246 ExplicitArgOffset = alignTo(ExplicitArgOffset, ABITypeAlign) + AllocSize;
247
248 // Skip inreg arguments which should be preloaded.
249 if (Arg.use_empty() || Arg.hasInRegAttr())
250 continue;
251
252 // If this is byval, the loads are already explicit in the function. We just
253 // need to rewrite the pointer values.
254 if (IsByRef) {
255 Value *ArgOffsetPtr = Builder.CreateConstInBoundsGEP1_64(
256 Builder.getInt8Ty(), KernArgSegment, EltOffset,
257 Arg.getName() + ".byval.kernarg.offset");
258
259 Value *CastOffsetPtr =
260 Builder.CreateAddrSpaceCast(ArgOffsetPtr, Arg.getType());
261 Arg.replaceAllUsesWith(CastOffsetPtr);
262 continue;
263 }
264
265 if (PointerType *PT = dyn_cast<PointerType>(ArgTy)) {
266 // FIXME: Hack. We rely on AssertZext to be able to fold DS addressing
267 // modes on SI to know the high bits are 0 so pointer adds don't wrap. We
268 // can't represent this with range metadata because it's only allowed for
269 // integer types.
270 if ((PT->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS ||
271 PT->getAddressSpace() == AMDGPUAS::REGION_ADDRESS) &&
272 !ST.hasUsableDSOffset())
273 continue;
274 }
275
276 auto *VT = dyn_cast<FixedVectorType>(ArgTy);
277 bool IsV3 = VT && VT->getNumElements() == 3;
278 bool DoShiftOpt = Size < 32 && !ArgTy->isAggregateType();
279
280 VectorType *V4Ty = nullptr;
281
282 int64_t AlignDownOffset = alignDown(EltOffset, 4);
283 int64_t OffsetDiff = EltOffset - AlignDownOffset;
284 Align AdjustedAlign = commonAlignment(
285 KernArgBaseAlign, DoShiftOpt ? AlignDownOffset : EltOffset);
286
287 Value *ArgPtr;
288 Type *AdjustedArgTy;
289 if (DoShiftOpt) { // FIXME: Handle aggregate types
290 // Since we don't have sub-dword scalar loads, avoid doing an extload by
291 // loading earlier than the argument address, and extracting the relevant
292 // bits.
293 // TODO: Update this for GFX12 which does have scalar sub-dword loads.
294 //
295 // Additionally widen any sub-dword load to i32 even if suitably aligned,
296 // so that CSE between different argument loads works easily.
297 ArgPtr = Builder.CreateConstInBoundsGEP1_64(
298 Builder.getInt8Ty(), KernArgSegment, AlignDownOffset,
299 Arg.getName() + ".kernarg.offset.align.down");
300 AdjustedArgTy = Builder.getInt32Ty();
301 } else {
302 ArgPtr = Builder.CreateConstInBoundsGEP1_64(
303 Builder.getInt8Ty(), KernArgSegment, EltOffset,
304 Arg.getName() + ".kernarg.offset");
305 AdjustedArgTy = ArgTy;
306 }
307
308 if (IsV3 && Size >= 32) {
309 V4Ty = FixedVectorType::get(VT->getElementType(), 4);
310 // Use the hack that clang uses to avoid SelectionDAG ruining v3 loads
311 AdjustedArgTy = V4Ty;
312 }
313
314 LoadInst *Load =
315 Builder.CreateAlignedLoad(AdjustedArgTy, ArgPtr, AdjustedAlign);
316 Load->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(Ctx, {}));
317
318 MDBuilder MDB(Ctx);
319
320 if (Arg.hasAttribute(Attribute::NoUndef) && AdjustedArgTy == ArgTy)
321 Load->setMetadata(LLVMContext::MD_noundef, MDNode::get(Ctx, {}));
322
323 if (Arg.hasAttribute(Attribute::Range) && AdjustedArgTy == ArgTy) {
324 const ConstantRange &Range =
325 Arg.getAttribute(Attribute::Range).getValueAsConstantRange();
326 Load->setMetadata(LLVMContext::MD_range,
327 MDB.createRange(Range.getLower(), Range.getUpper()));
328 }
329
330 if (Arg.hasAttribute(Attribute::NoFPClass) && AdjustedArgTy == ArgTy) {
331 FPClassTest Mask = Arg.getNoFPClass();
332 Load->setMetadata(
333 LLVMContext::MD_nofpclass,
335 ConstantInt::get(Type::getInt32Ty(Ctx), Mask))));
336 }
337
338 if (isa<PointerType>(ArgTy)) {
339 if (Arg.hasNonNullAttr())
340 Load->setMetadata(LLVMContext::MD_nonnull, MDNode::get(Ctx, {}));
341
342 uint64_t DerefBytes = Arg.getDereferenceableBytes();
343 if (DerefBytes != 0) {
344 Load->setMetadata(
345 LLVMContext::MD_dereferenceable,
346 MDNode::get(Ctx,
347 MDB.createConstant(
348 ConstantInt::get(Builder.getInt64Ty(), DerefBytes))));
349 }
350
351 uint64_t DerefOrNullBytes = Arg.getDereferenceableOrNullBytes();
352 if (DerefOrNullBytes != 0) {
353 Load->setMetadata(
354 LLVMContext::MD_dereferenceable_or_null,
355 MDNode::get(Ctx,
356 MDB.createConstant(ConstantInt::get(Builder.getInt64Ty(),
357 DerefOrNullBytes))));
358 }
359
360 if (MaybeAlign ParamAlign = Arg.getParamAlign()) {
361 Load->setMetadata(
362 LLVMContext::MD_align,
363 MDNode::get(Ctx, MDB.createConstant(ConstantInt::get(
364 Builder.getInt64Ty(), ParamAlign->value()))));
365 }
366 }
367
368 if (DoShiftOpt) {
369 Value *ExtractBits = OffsetDiff == 0 ?
370 Load : Builder.CreateLShr(Load, OffsetDiff * 8);
371
372 IntegerType *ArgIntTy = Builder.getIntNTy(Size);
373 Value *Trunc = Builder.CreateTrunc(ExtractBits, ArgIntTy);
374 Value *NewVal = Builder.CreateBitCast(Trunc, ArgTy,
375 Arg.getName() + ".load");
376 Arg.replaceAllUsesWith(NewVal);
377 } else if (IsV3) {
378 Value *Shuf = Builder.CreateShuffleVector(Load, ArrayRef<int>{0, 1, 2},
379 Arg.getName() + ".load");
380 Arg.replaceAllUsesWith(Shuf);
381 } else {
382 Load->setName(Arg.getName() + ".load");
383 Arg.replaceAllUsesWith(Load);
384 }
385 }
386
387 KernArgSegment->addRetAttr(
388 Attribute::getWithAlignment(Ctx, std::max(KernArgBaseAlign, MaxAlign)));
389
390 return true;
391}
392
393bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
394 auto &TPC = getAnalysis<TargetPassConfig>();
395 const TargetMachine &TM = TPC.getTM<TargetMachine>();
396 DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
397 return lowerKernelArguments(F, TM, DT);
398}
399
400INITIALIZE_PASS_BEGIN(AMDGPULowerKernelArguments, DEBUG_TYPE,
401 "AMDGPU Lower Kernel Arguments", false, false)
402INITIALIZE_PASS_END(AMDGPULowerKernelArguments, DEBUG_TYPE, "AMDGPU Lower Kernel Arguments",
404
405char AMDGPULowerKernelArguments::ID = 0;
406
408 return new AMDGPULowerKernelArguments();
409}
410
414 bool Changed = lowerKernelArguments(F, TM, DT);
415 if (Changed) {
416 // TODO: Preserves a lot more.
419 return PA;
420 }
421
422 return PreservedAnalyses::all();
423}
unsigned uint64_t
static void addAliasScopeMetadata(Function &F, const DataLayout &DL, DominatorTree &DT)
static BasicBlock::iterator getInsertPt(BasicBlock &BB)
static bool lowerKernelArguments(Function &F, const TargetMachine &TM, DominatorTree &DT)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< bool > NoAliases("csky-no-aliases", cl::desc("Disable the emission of assembler pseudo instructions"), cl::init(false), cl::Hidden)
static bool runOnFunction(Function &F, bool PostInlining)
AMD GCN specific subclass of TargetSubtarget.
#define DEBUG_TYPE
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition PassSupport.h:39
This is the interface for a metadata-based scoped no-alias analysis.
Target-Independent Code Generator Pass Configuration Options pass.
PreservedAnalyses run(Function &, FunctionAnalysisManager &)
an instruction to allocate memory on the stack
LLVM_ABI bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
static LLVM_ABI Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
static LLVM_ABI Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
iterator end()
Definition BasicBlock.h:459
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...
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
void addRetAttr(Attribute::AttrKind Kind)
Adds the attribute to the return value.
This class represents a function call, abstracting a target machine's calling convention.
static ConstantAsMetadata * get(Constant *C)
Definition Metadata.h:548
This class represents a range of values.
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition DenseMap.h:319
Analysis pass which computes a DominatorTree.
Definition Dominators.h:241
Legacy analysis pass which computes a DominatorTree.
Definition Dominators.h:277
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:122
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition Type.cpp:843
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2908
Class to represent integer types.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
An instruction for reading from memory.
MDNode * createAnonymousAliasScope(MDNode *Domain, StringRef Name=StringRef())
Return metadata appropriate for an alias scope root node.
Definition MDBuilder.h:195
LLVM_ABI ConstantAsMetadata * createConstant(Constant *C)
Return the given constant as metadata.
Definition MDBuilder.cpp:25
LLVM_ABI MDNode * createRange(const APInt &Lo, const APInt &Hi)
Return metadata describing the range [Lo, Hi).
Definition MDBuilder.cpp:96
MDNode * createAnonymousAliasScopeDomain(StringRef Name=StringRef())
Return metadata appropriate for an alias scope domain node.
Definition MDBuilder.h:188
Metadata node.
Definition Metadata.h:1081
static LLVM_ABI MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1578
bool doesNotAccessMemory() const
Whether this function accesses no memory.
Definition ModRef.h:246
bool onlyAccessesInaccessibleMem() const
Whether this function only (at most) accesses inaccessible memory.
Definition ModRef.h:265
bool onlyAccessesArgPointees() const
Whether this function only (at most) accesses argument memory.
Definition ModRef.h:255
static LLVM_ABI std::optional< MemoryLocation > getOrNone(const Instruction *Inst)
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
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
void insert_range(Range &&R)
bool contains(ConstPtrType Ptr) const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Primary interface to the complete machine description for the target machine.
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.
Target-Independent Code Generator Pass Configuration Options.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:299
bool isAggregateType() const
Return true if the type is an aggregate type.
Definition Type.h:314
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition Type.cpp:303
LLVM Value Representation.
Definition Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition Value.h:257
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition Value.cpp:553
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Definition Value.cpp:319
CallInst * Call
Changed
@ REGION_ADDRESS
Address space for region memory. (GDS)
@ LOCAL_ADDRESS
Address space for local memory.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ AMDGPU_KERNEL
Used for AMDGPU code object kernels.
This is an optimization pass for GlobalISel generic memory operations.
InstIterator< SymbolTableList< BasicBlock >, Function::iterator, BasicBlock::iterator, Instruction > inst_iterator
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
@ Load
The value being inserted comes from a load (InsertElement only).
constexpr T alignDown(U Value, V Align, W Skew=0)
Returns the largest unsigned integer less than or equal to Value and is Skew mod Align.
Definition MathExtras.h:541
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
Definition ModRef.h:356
inst_iterator inst_begin(Function *F)
LLVM_ABI bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, const Instruction *I, const DominatorTree *DT, bool IncludeI=false, unsigned MaxUsesToExplore=0, const LoopInfo *LI=nullptr)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
FunctionPass * createAMDGPULowerKernelArgumentsPass()
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:144
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
inst_iterator inst_end(Function *F)
LLVM_ABI bool isEscapeSource(const Value *V)
Returns true if the pointer is one which would have been considered an escape by isNotCapturedBefore.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
Definition Alignment.h:201
bool capturesAnything(CaptureComponents CC)
Definition ModRef.h:379
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI void getUnderlyingObjects(const Value *V, SmallVectorImpl< const Value * > &Objects, const LoopInfo *LI=nullptr, unsigned MaxLookup=MaxLookupSearchDepth)
This method is similar to getUnderlyingObject except that it can look through phi and select instruct...
LLVM_ABI bool isIdentifiedObject(const Value *V)
Return true if this pointer refers to a distinct and identifiable object.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:106