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. The scopes are disjoint, since
85 // an access based on one noalias argument can't modify memory an access based
86 // on another one reads.
87 MDBuilder MDB(F.getContext());
89 MDNode *NewDomain =
90 MDB.createAnonymousAliasScopeDomain(F.getName(), /*DisjointScopes=*/true);
91
92 for (unsigned I = 0u; I < NoAliasArgs.size(); ++I) {
93 const Argument *Arg = NoAliasArgs[I];
94 MDNode *NewScope = MDB.createAnonymousAliasScope(NewDomain, Arg->getName());
95 NewScopes.insert({Arg, NewScope});
96 }
97
98 // Iterate over all instructions.
99 for (inst_iterator Inst = inst_begin(F), InstEnd = inst_end(F);
100 Inst != InstEnd; ++Inst) {
101 // If instruction accesses memory, collect its pointer arguments.
102 Instruction *I = &(*Inst);
104 // May reach a noalias argument via a copy captured before the call.
105 bool IsUnrestrictedCall = false;
106
107 if (std::optional<MemoryLocation> MO = MemoryLocation::getOrNone(I))
108 PtrArgs.push_back(MO->Ptr);
109 else if (const CallBase *Call = dyn_cast<CallBase>(I)) {
110 MemoryEffects ME = Call->getMemoryEffects();
111 if (ME.doesNotAccessMemory())
112 continue;
113
114 // Inaccessible memory cannot alias any IR-visible pointer.
116 continue;
117 IsUnrestrictedCall = !ME.onlyAccessesArgPointees();
118
119 for (Value *Arg : Call->args()) {
120 if (!Arg->getType()->isPointerTy())
121 continue;
122
123 PtrArgs.push_back(Arg);
124 }
125 } else {
126 // Not a memory access and not a call — nothing to annotate.
127 continue;
128 }
129
130 // Collect underlying objects of pointer arguments.
134
135 for (const Value *Val : PtrArgs) {
137 getUnderlyingObjects(Val, Objects);
138 ObjSet.insert_range(Objects);
139 }
140
141 bool RequiresNoCaptureBefore = false;
142 bool UsesUnknownObject = false;
143 bool UsesAliasingPtr = false;
144
145 for (const Value *Val : ObjSet) {
146 if (isa<ConstantData>(Val))
147 continue;
148
149 if (const Argument *Arg = dyn_cast<Argument>(Val)) {
150 if (!Arg->hasAttribute(Attribute::NoAlias))
151 UsesAliasingPtr = true;
152 } else
153 UsesAliasingPtr = true;
154
155 if (isEscapeSource(Val)) {
156 // Can only alias a noalias argument if captured beforehand.
157 RequiresNoCaptureBefore = true;
158 } else if (!isa<Argument>(Val) && !isIdentifiedObject(Val)) {
159 // Unknown provenance: assume nothing.
160 UsesUnknownObject = true;
161 }
162 }
163
164 if (UsesUnknownObject)
165 continue;
166
167 if (IsUnrestrictedCall)
168 RequiresNoCaptureBefore = true;
169
170 // Collect scopes for alias.scope metadata. Skip unrestricted calls: they
171 // may touch memory beyond their pointer arguments' pointees.
172 if (!UsesAliasingPtr && !IsUnrestrictedCall)
173 for (const Argument *Arg : NoAliasArgs) {
174 if (ObjSet.count(Arg))
175 Scopes.push_back(NewScopes[Arg]);
176 }
177
178 // Collect noalias scopes for the instruction not implied by its scopes.
179 // Scopes is only non-empty when no underlying object is an escape source
180 // and the instruction isn't an unrestricted call.
181 if (Scopes.empty())
182 for (const Argument *Arg : NoAliasArgs) {
183 if (ObjSet.contains(Arg))
184 continue;
185
186 if (!RequiresNoCaptureBefore ||
188 Arg, false, I, &DT, false, CaptureComponents::Provenance)))
189 NoAliases.push_back(NewScopes[Arg]);
190 }
191
192 // Add noalias metadata to instruction.
193 if (!NoAliases.empty()) {
194 MDNode *NewMD =
195 MDNode::concatenate(Inst->getMetadata(LLVMContext::MD_noalias),
196 MDNode::get(F.getContext(), NoAliases));
197 Inst->setMetadata(LLVMContext::MD_noalias, NewMD);
198 }
199
200 // Add alias.scope metadata to instruction.
201 if (!Scopes.empty()) {
202 MDNode *NewMD =
203 MDNode::concatenate(Inst->getMetadata(LLVMContext::MD_alias_scope),
204 MDNode::get(F.getContext(), Scopes));
205 Inst->setMetadata(LLVMContext::MD_alias_scope, NewMD);
206 }
207 }
208}
209
211 DominatorTree &DT) {
212 CallingConv::ID CC = F.getCallingConv();
213 if (CC != CallingConv::AMDGPU_KERNEL || F.arg_empty())
214 return false;
215
216 const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
217 LLVMContext &Ctx = F.getContext();
218 const DataLayout &DL = F.getDataLayout();
219 BasicBlock &EntryBlock = *F.begin();
220 IRBuilder<> Builder(getInsertPt(EntryBlock));
221
222 const Align KernArgBaseAlign(16); // FIXME: Increase if necessary
223 const uint64_t BaseOffset = ST.getExplicitKernelArgOffset();
224
225 Align MaxAlign;
226 // FIXME: Alignment is broken with explicit arg offset.;
227 const uint64_t TotalKernArgSize = ST.getKernArgSegmentSize(F, MaxAlign);
228 if (TotalKernArgSize == 0)
229 return false;
230
231 CallInst *KernArgSegment = Builder.CreateIntrinsicWithoutFolding(
232 Intrinsic::amdgcn_kernarg_segment_ptr, {}, nullptr,
233 F.getName() + ".kernarg.segment");
234 KernArgSegment->addRetAttr(Attribute::NonNull);
235 KernArgSegment->addRetAttr(
236 Attribute::getWithDereferenceableBytes(Ctx, TotalKernArgSize));
237
238 uint64_t ExplicitArgOffset = 0;
239
240 addAliasScopeMetadata(F, F.getDataLayout(), DT);
241
242 for (Argument &Arg : F.args()) {
243 const bool IsByRef = Arg.hasByRefAttr();
244 Type *ArgTy = IsByRef ? Arg.getParamByRefType() : Arg.getType();
245 MaybeAlign ParamAlign = IsByRef ? Arg.getParamAlign() : std::nullopt;
246 Align ABITypeAlign = DL.getValueOrABITypeAlignment(ParamAlign, ArgTy);
247
248 uint64_t Size = DL.getTypeSizeInBits(ArgTy);
249 uint64_t AllocSize = DL.getTypeAllocSize(ArgTy);
250
251 uint64_t EltOffset = alignTo(ExplicitArgOffset, ABITypeAlign) + BaseOffset;
252 ExplicitArgOffset = alignTo(ExplicitArgOffset, ABITypeAlign) + AllocSize;
253
254 // Skip inreg arguments which should be preloaded.
255 if (Arg.use_empty() || Arg.hasInRegAttr())
256 continue;
257
258 // If this is byval, the loads are already explicit in the function. We just
259 // need to rewrite the pointer values.
260 if (IsByRef) {
261 Value *ArgOffsetPtr = Builder.CreateConstInBoundsGEP1_64(
262 Builder.getInt8Ty(), KernArgSegment, EltOffset,
263 Arg.getName() + ".byval.kernarg.offset");
264
265 Value *CastOffsetPtr =
266 Builder.CreateAddrSpaceCast(ArgOffsetPtr, Arg.getType());
267 Arg.replaceAllUsesWith(CastOffsetPtr);
268 continue;
269 }
270
271 if (PointerType *PT = dyn_cast<PointerType>(ArgTy)) {
272 // FIXME: Hack. We rely on AssertZext to be able to fold DS addressing
273 // modes on SI to know the high bits are 0 so pointer adds don't wrap. We
274 // can't represent this with range metadata because it's only allowed for
275 // integer types.
276 if ((PT->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS ||
277 PT->getAddressSpace() == AMDGPUAS::REGION_ADDRESS) &&
278 !ST.hasUsableDSOffset())
279 continue;
280 }
281
282 auto *VT = dyn_cast<FixedVectorType>(ArgTy);
283 bool IsV3 = VT && VT->getNumElements() == 3;
284 bool DoShiftOpt = Size < 32 && !ArgTy->isAggregateType();
285
286 VectorType *V4Ty = nullptr;
287
288 int64_t AlignDownOffset = alignDown(EltOffset, 4);
289 int64_t OffsetDiff = EltOffset - AlignDownOffset;
290 Align AdjustedAlign = commonAlignment(
291 KernArgBaseAlign, DoShiftOpt ? AlignDownOffset : EltOffset);
292
293 Value *ArgPtr;
294 Type *AdjustedArgTy;
295 if (DoShiftOpt) { // FIXME: Handle aggregate types
296 // Since we don't have sub-dword scalar loads, avoid doing an extload by
297 // loading earlier than the argument address, and extracting the relevant
298 // bits.
299 // TODO: Update this for GFX12 which does have scalar sub-dword loads.
300 //
301 // Additionally widen any sub-dword load to i32 even if suitably aligned,
302 // so that CSE between different argument loads works easily.
303 ArgPtr = Builder.CreateConstInBoundsGEP1_64(
304 Builder.getInt8Ty(), KernArgSegment, AlignDownOffset,
305 Arg.getName() + ".kernarg.offset.align.down");
306 AdjustedArgTy = Builder.getInt32Ty();
307 } else {
308 ArgPtr = Builder.CreateConstInBoundsGEP1_64(
309 Builder.getInt8Ty(), KernArgSegment, EltOffset,
310 Arg.getName() + ".kernarg.offset");
311 AdjustedArgTy = ArgTy;
312 }
313
314 if (IsV3 && Size >= 32) {
315 V4Ty = FixedVectorType::get(VT->getElementType(), 4);
316 // Use the hack that clang uses to avoid SelectionDAG ruining v3 loads
317 AdjustedArgTy = V4Ty;
318 }
319
320 LoadInst *Load =
321 Builder.CreateAlignedLoad(AdjustedArgTy, ArgPtr, AdjustedAlign);
322 Load->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(Ctx, {}));
323
324 MDBuilder MDB(Ctx);
325
326 if (Arg.hasAttribute(Attribute::NoUndef) && AdjustedArgTy == ArgTy)
327 Load->setMetadata(LLVMContext::MD_noundef, MDNode::get(Ctx, {}));
328
329 if (Arg.hasAttribute(Attribute::Range) && AdjustedArgTy == ArgTy) {
330 const ConstantRange &Range =
331 Arg.getAttribute(Attribute::Range).getValueAsConstantRange();
332 Load->setMetadata(LLVMContext::MD_range,
333 MDB.createRange(Range.getLower(), Range.getUpper()));
334 }
335
336 if (Arg.hasAttribute(Attribute::NoFPClass) && AdjustedArgTy == ArgTy) {
337 FPClassTest Mask = Arg.getNoFPClass();
338 Load->setMetadata(
339 LLVMContext::MD_nofpclass,
341 ConstantInt::get(Type::getInt32Ty(Ctx), Mask))));
342 }
343
344 if (isa<PointerType>(ArgTy)) {
345 if (Arg.hasNonNullAttr())
346 Load->setMetadata(LLVMContext::MD_nonnull, MDNode::get(Ctx, {}));
347
348 uint64_t DerefBytes = Arg.getDereferenceableBytes();
349 if (DerefBytes != 0) {
350 Load->setMetadata(
351 LLVMContext::MD_dereferenceable,
352 MDNode::get(Ctx,
353 MDB.createConstant(
354 ConstantInt::get(Builder.getInt64Ty(), DerefBytes))));
355 }
356
357 uint64_t DerefOrNullBytes = Arg.getDereferenceableOrNullBytes();
358 if (DerefOrNullBytes != 0) {
359 Load->setMetadata(
360 LLVMContext::MD_dereferenceable_or_null,
361 MDNode::get(Ctx,
362 MDB.createConstant(ConstantInt::get(Builder.getInt64Ty(),
363 DerefOrNullBytes))));
364 }
365
366 if (MaybeAlign ParamAlign = Arg.getParamAlign()) {
367 Load->setMetadata(
368 LLVMContext::MD_align,
369 MDNode::get(Ctx, MDB.createConstant(ConstantInt::get(
370 Builder.getInt64Ty(), ParamAlign->value()))));
371 }
372 }
373
374 if (DoShiftOpt) {
375 Value *ExtractBits = OffsetDiff == 0 ?
376 Load : Builder.CreateLShr(Load, OffsetDiff * 8);
377
378 IntegerType *ArgIntTy = Builder.getIntNTy(Size);
379 Value *Trunc = Builder.CreateTrunc(ExtractBits, ArgIntTy);
380 Value *NewVal = Builder.CreateBitCast(Trunc, ArgTy,
381 Arg.getName() + ".load");
382 Arg.replaceAllUsesWith(NewVal);
383 } else if (IsV3) {
384 Value *Shuf = Builder.CreateShuffleVector(Load, ArrayRef<int>{0, 1, 2},
385 Arg.getName() + ".load");
386 Arg.replaceAllUsesWith(Shuf);
387 } else {
388 Load->setName(Arg.getName() + ".load");
389 Arg.replaceAllUsesWith(Load);
390 }
391 }
392
393 KernArgSegment->addRetAttr(
394 Attribute::getWithAlignment(Ctx, std::max(KernArgBaseAlign, MaxAlign)));
395
396 return true;
397}
398
399bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
400 auto &TPC = getAnalysis<TargetPassConfig>();
401 const TargetMachine &TM = TPC.getTM<TargetMachine>();
402 DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
403 return lowerKernelArguments(F, TM, DT);
404}
405
406INITIALIZE_PASS_BEGIN(AMDGPULowerKernelArguments, DEBUG_TYPE,
407 "AMDGPU Lower Kernel Arguments", false, false)
408INITIALIZE_PASS_END(AMDGPULowerKernelArguments, DEBUG_TYPE, "AMDGPU Lower Kernel Arguments",
410
411char AMDGPULowerKernelArguments::ID = 0;
412
414 return new AMDGPULowerKernelArguments();
415}
416
420 bool Changed = lowerKernelArguments(F, TM, DT);
421 if (Changed) {
422 // TODO: Preserves a lot more.
425 return PA;
426 }
427
428 return PreservedAnalyses::all();
429}
uint64_t 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 bool runOnFunction(Function &F, bool PostInlining)
AMD GCN specific subclass of TargetSubtarget.
#define DEBUG_TYPE
static cl::opt< bool > NoAliases("loongarch-no-aliases", cl::desc("Disable the emission of assembler pseudo instructions"), cl::init(false), cl::Hidden)
#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
RISCVCC::CondCode CC
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:453
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:827
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:838
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2990
Class to represent integer types.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
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:92
LLVM_ABI MDNode * createAnonymousAliasScopeDomain(StringRef Description=StringRef(), bool DisjointScopes=false)
Return metadata appropriate for an alias scope domain node, described by Description,...
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:1582
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:152
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:294
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:298
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:548
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Definition Value.cpp:314
CallInst * Call
@ 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:546
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:149
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:206
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:111