31#include "llvm/IR/IntrinsicsAMDGPU.h"
36#define DEBUG_TYPE "amdgpu-atomic-optimizer"
43struct ReplacementInfo {
67class AMDGPUAtomicOptimizerImpl
80 Value *
const Identity)
const;
82 Value *
const Identity)
const;
85 std::pair<Value *, Value *>
91 bool ValDivergent,
bool IsLDS)
const;
94 AMDGPUAtomicOptimizerImpl() =
delete;
99 :
F(
F), UA(UA),
DL(
F.getDataLayout()), DTU(DTU), ST(ST),
101 ScanImpl(ScanImpl) {}
111char AMDGPUAtomicOptimizer::ID = 0;
115bool AMDGPUAtomicOptimizer::runOnFunction(
Function &
F) {
116 if (skipFunction(
F)) {
121 getAnalysis<UniformityInfoWrapperPass>().getUniformityInfo();
124 getAnalysisIfAvailable<DominatorTreeWrapperPass>();
126 DomTreeUpdater::UpdateStrategy::Lazy);
132 return AMDGPUAtomicOptimizerImpl(
F, UA, DTU, ST, ScanImpl).run();
140 DomTreeUpdater::UpdateStrategy::Lazy);
143 bool IsChanged = AMDGPUAtomicOptimizerImpl(
F, UA, DTU, ST, ScanImpl).run();
154bool AMDGPUAtomicOptimizerImpl::run() {
162 if (ToReplace.empty())
165 for (
auto &[
I,
Op, ValIdx, ValDivergent, IsLDS] : ToReplace)
166 optimizeAtomic(*
I,
Op, ValIdx, ValDivergent, IsLDS);
172 switch (Ty->getTypeID()) {
177 unsigned Size = Ty->getIntegerBitWidth();
185void AMDGPUAtomicOptimizerImpl::visitAtomicRMWInst(AtomicRMWInst &
I) {
186 if (
I.getType()->isVectorTy() ||
I.isVolatile())
190 switch (
I.getPointerAddressSpace()) {
221 !(
I.getType()->isFloatTy() ||
I.getType()->isDoubleTy())) {
225 const unsigned PtrIdx = 0;
226 const unsigned ValIdx = 1;
241 if (ScanImpl == ScanOptions::DPP && !ST.hasDPP())
253 ToReplace.push_back({&
I,
Op, ValIdx, ValDivergent, IsLDS});
256void AMDGPUAtomicOptimizerImpl::visitIntrinsicInst(IntrinsicInst &
I) {
257 if (
I.getType()->isVectorTy())
262 switch (
I.getIntrinsicID()) {
265 case Intrinsic::amdgcn_struct_buffer_atomic_add:
266 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_add:
267 case Intrinsic::amdgcn_raw_buffer_atomic_add:
268 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_add:
271 case Intrinsic::amdgcn_struct_buffer_atomic_sub:
272 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_sub:
273 case Intrinsic::amdgcn_raw_buffer_atomic_sub:
274 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_sub:
277 case Intrinsic::amdgcn_struct_buffer_atomic_and:
278 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_and:
279 case Intrinsic::amdgcn_raw_buffer_atomic_and:
280 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_and:
283 case Intrinsic::amdgcn_struct_buffer_atomic_or:
284 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_or:
285 case Intrinsic::amdgcn_raw_buffer_atomic_or:
286 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_or:
289 case Intrinsic::amdgcn_struct_buffer_atomic_xor:
290 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_xor:
291 case Intrinsic::amdgcn_raw_buffer_atomic_xor:
292 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_xor:
295 case Intrinsic::amdgcn_struct_buffer_atomic_smin:
296 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_smin:
297 case Intrinsic::amdgcn_raw_buffer_atomic_smin:
298 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_smin:
301 case Intrinsic::amdgcn_struct_buffer_atomic_umin:
302 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_umin:
303 case Intrinsic::amdgcn_raw_buffer_atomic_umin:
304 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_umin:
307 case Intrinsic::amdgcn_struct_buffer_atomic_smax:
308 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_smax:
309 case Intrinsic::amdgcn_raw_buffer_atomic_smax:
310 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_smax:
313 case Intrinsic::amdgcn_struct_buffer_atomic_umax:
314 case Intrinsic::amdgcn_struct_ptr_buffer_atomic_umax:
315 case Intrinsic::amdgcn_raw_buffer_atomic_umax:
316 case Intrinsic::amdgcn_raw_ptr_buffer_atomic_umax:
325 const unsigned ValIdx = 0;
334 if (ScanImpl == ScanOptions::DPP && !ST.hasDPP())
343 for (
unsigned Idx = 1; Idx <
I.getNumOperands(); Idx++) {
352 ToReplace.push_back({&
I,
Op, ValIdx, ValDivergent,
false});
365 return B.CreateBinOp(Instruction::Add,
LHS,
RHS);
369 return B.CreateBinOp(Instruction::Sub,
LHS,
RHS);
373 return B.CreateBinOp(Instruction::And,
LHS,
RHS);
375 return B.CreateBinOp(Instruction::Or,
LHS,
RHS);
377 return B.CreateBinOp(Instruction::Xor,
LHS,
RHS);
392 return B.CreateMaxNum(
LHS,
RHS);
394 return B.CreateMinNum(
LHS,
RHS);
405 Value *
const Identity)
const {
406 Type *AtomicTy =
V->getType();
407 Module *
M =
B.GetInsertBlock()->getModule();
410 for (
unsigned Idx = 0; Idx < 4; Idx++) {
413 B.CreateIntrinsic(Intrinsic::amdgcn_update_dpp, AtomicTy,
414 {Identity, V, B.getInt32(DPP::ROW_XMASK0 | 1 << Idx),
415 B.getInt32(0xf), B.getInt32(0xf), B.getFalse()}));
419 assert(ST.hasPermlane16Insts());
420 Value *Permlanex16Call =
421 B.CreateIntrinsic(AtomicTy, Intrinsic::amdgcn_permlanex16,
423 B.getInt32(0),
B.getFalse(),
B.getFalse()});
431 Value *Permlane64Call =
432 B.CreateIntrinsic(AtomicTy, Intrinsic::amdgcn_permlane64,
V);
439 M, Intrinsic::amdgcn_readlane, AtomicTy);
440 Value *Lane0 =
B.CreateCall(ReadLane, {
V,
B.getInt32(0)});
441 Value *Lane32 =
B.CreateCall(ReadLane, {
V,
B.getInt32(32)});
449 Value *Identity)
const {
450 Type *AtomicTy =
V->getType();
451 Module *
M =
B.GetInsertBlock()->getModule();
453 M, Intrinsic::amdgcn_update_dpp, AtomicTy);
455 for (
unsigned Idx = 0; Idx < 4; Idx++) {
458 B.CreateCall(UpdateDPP,
459 {Identity, V, B.getInt32(DPP::ROW_SHR0 | 1 << Idx),
460 B.getInt32(0xf), B.getInt32(0xf), B.getFalse()}));
462 if (ST.hasDPPBroadcasts()) {
466 B.CreateCall(UpdateDPP,
467 {Identity, V, B.getInt32(DPP::BCAST15), B.getInt32(0xa),
468 B.getInt32(0xf), B.getFalse()}));
471 B.CreateCall(UpdateDPP,
472 {Identity, V, B.getInt32(DPP::BCAST31), B.getInt32(0xc),
473 B.getInt32(0xf), B.getFalse()}));
480 assert(ST.hasPermlane16Insts());
482 B.CreateIntrinsic(AtomicTy, Intrinsic::amdgcn_permlanex16,
484 B.getInt32(-1),
B.getFalse(),
B.getFalse()});
486 Value *UpdateDPPCall =
B.CreateCall(
488 B.getInt32(0xa),
B.getInt32(0xf),
B.getFalse()});
493 Value *
const Lane31 =
B.CreateIntrinsic(
494 AtomicTy, Intrinsic::amdgcn_readlane, {
V,
B.getInt32(31)});
496 Value *UpdateDPPCall =
B.CreateCall(
498 B.getInt32(0xc),
B.getInt32(0xf),
B.getFalse()});
509 Value *Identity)
const {
510 Type *AtomicTy =
V->getType();
511 Module *
M =
B.GetInsertBlock()->getModule();
513 M, Intrinsic::amdgcn_update_dpp, AtomicTy);
514 if (ST.hasDPPWavefrontShifts()) {
516 V =
B.CreateCall(UpdateDPP,
518 B.getInt32(0xf),
B.getFalse()});
521 M, Intrinsic::amdgcn_readlane, AtomicTy);
523 M, Intrinsic::amdgcn_writelane, AtomicTy);
528 V =
B.CreateCall(UpdateDPP,
530 B.getInt32(0xf),
B.getInt32(0xf),
B.getFalse()});
533 V =
B.CreateCall(WriteLane, {
B.CreateCall(ReadLane, {Old,
B.getInt32(15)}),
540 {
B.CreateCall(ReadLane, {Old,
B.getInt32(31)}),
B.getInt32(32),
V});
545 {
B.CreateCall(ReadLane, {Old,
B.getInt32(47)}),
B.getInt32(48),
V});
557std::pair<Value *, Value *> AMDGPUAtomicOptimizerImpl::buildScanIteratively(
559 Instruction &
I, BasicBlock *ComputeLoop, BasicBlock *ComputeEnd)
const {
560 auto *Ty =
I.getType();
562 auto *EntryBB =
I.getParent();
563 auto NeedResult = !
I.use_empty();
566 B.CreateIntrinsic(Intrinsic::amdgcn_ballot, WaveTy,
B.getTrue());
569 B.SetInsertPoint(ComputeLoop);
573 PHINode *OldValuePhi =
nullptr;
575 OldValuePhi =
B.CreatePHI(Ty, 2,
"OldValuePhi");
578 auto *ActiveBits =
B.CreatePHI(WaveTy, 2,
"ActiveBits");
579 ActiveBits->addIncoming(Ballot, EntryBB);
583 B.CreateIntrinsic(Intrinsic::cttz, WaveTy, {ActiveBits,
B.getTrue()});
585 auto *LaneIdxInt =
B.CreateTrunc(FF1,
B.getInt32Ty());
588 Value *LaneValue =
B.CreateIntrinsic(
V->getType(), Intrinsic::amdgcn_readlane,
593 Value *OldValue =
nullptr;
595 OldValue =
B.CreateIntrinsic(
V->getType(), Intrinsic::amdgcn_writelane,
596 {Accumulator, LaneIdxInt, OldValuePhi});
602 Accumulator->addIncoming(NewAccumulator, ComputeLoop);
606 auto *
Mask =
B.CreateShl(ConstantInt::get(WaveTy, 1), FF1);
608 auto *InverseMask =
B.CreateXor(Mask, ConstantInt::getAllOnesValue(WaveTy));
609 auto *NewActiveBits =
B.CreateAnd(ActiveBits, InverseMask);
610 ActiveBits->addIncoming(NewActiveBits, ComputeLoop);
613 auto *IsEnd =
B.CreateICmpEQ(NewActiveBits, ConstantInt::get(WaveTy, 0));
614 B.CreateCondBr(IsEnd, ComputeEnd, ComputeLoop);
616 B.SetInsertPoint(ComputeEnd);
618 return {OldValue, NewAccumulator};
624 const unsigned BitWidth = Ty->getPrimitiveSizeInBits();
659 "Atomic Op yet to be ported to use Wave Reduction intrinsics.");
662 return Intrinsic::amdgcn_wave_reduce_add;
665 return Intrinsic::amdgcn_wave_reduce_fadd;
667 return Intrinsic::amdgcn_wave_reduce_and;
669 return Intrinsic::amdgcn_wave_reduce_or;
671 return Intrinsic::amdgcn_wave_reduce_xor;
673 return Intrinsic::amdgcn_wave_reduce_umax;
675 return Intrinsic::amdgcn_wave_reduce_max;
677 return Intrinsic::amdgcn_wave_reduce_fmax;
679 return Intrinsic::amdgcn_wave_reduce_umin;
681 return Intrinsic::amdgcn_wave_reduce_min;
683 return Intrinsic::amdgcn_wave_reduce_fmin;
692void AMDGPUAtomicOptimizerImpl::optimizeAtomic(Instruction &
I,
703 if (IsLDS && ValDivergent && ScanImpl == ScanOptions::DPP) {
704 if (MDNode *MD =
I.getMetadata(
"amdgpu.expected.active.lanes")) {
706 constexpr unsigned ActiveLanesThreshold = 5;
707 if (CI->getValue().ule(ActiveLanesThreshold))
716 B.setIsFPConstrained(
I.getFunction()->hasFnAttribute(Attribute::StrictFP));
733 Value *
const Cond =
B.CreateIntrinsic(Intrinsic::amdgcn_ps_live, {});
741 B.SetInsertPoint(&
I);
744 Type *
const Ty =
I.getType();
745 Type *Int32Ty =
B.getInt32Ty();
747 [[maybe_unused]]
const unsigned TyBitWidth =
DL.getTypeSizeInBits(Ty);
751 Value *
V =
I.getOperand(ValIdx);
756 CallInst *
const Ballot =
B.CreateIntrinsicWithoutFolding(
757 Intrinsic::amdgcn_ballot, WaveTy,
B.getTrue());
766 B.CreateIntrinsic(Intrinsic::amdgcn_mbcnt_lo, {Ballot,
B.getInt32(0)});
768 Value *
const ExtractLo =
B.CreateTrunc(Ballot, Int32Ty);
769 Value *
const ExtractHi =
B.CreateTrunc(
B.CreateLShr(Ballot, 32), Int32Ty);
770 Mbcnt =
B.CreateIntrinsic(Intrinsic::amdgcn_mbcnt_lo,
771 {ExtractLo,
B.getInt32(0)});
772 Mbcnt =
B.CreateIntrinsic(Intrinsic::amdgcn_mbcnt_hi, {ExtractHi, Mbcnt});
776 LLVMContext &
C =
F->getContext();
777 const bool NeedResult = !
I.use_empty();
778 const bool UseWaveReductionIntrinsic = !ValDivergent || !NeedResult;
790 Value *ExclScan =
nullptr;
791 Value *NewV =
nullptr;
795 if (UseWaveReductionIntrinsic) {
797 unsigned Strategy = ScanImpl == ScanOptions::DPP ? 2 : 1;
799 NewV =
B.CreateIntrinsic(WaveRedIntrinsic, Ty, {
V,
B.getInt32(Strategy)});
803 assert(ValDivergent && NeedResult);
804 if (ScanImpl == ScanOptions::DPP) {
808 B.CreateIntrinsic(Intrinsic::amdgcn_set_inactive, Ty, {
V, Identity});
809 if (!NeedResult && ST.hasPermlane16Insts()) {
813 NewV = buildReduction(
B, ScanOp, NewV, Identity);
815 NewV = buildScan(
B, ScanOp, NewV, Identity);
817 ExclScan = buildShiftRight(
B, NewV, Identity);
822 NewV =
B.CreateIntrinsic(Ty, Intrinsic::amdgcn_readlane,
823 {NewV, LastLaneIdx});
826 NewV =
B.CreateIntrinsic(Intrinsic::amdgcn_strict_wwm, Ty, NewV);
827 }
else if (ScanImpl == ScanOptions::Iterative) {
831 std::tie(ExclScan, NewV) = buildScanIteratively(
B, ScanOp, Identity,
V,
I,
832 ComputeLoop, ComputeEnd);
841 Value *
const Cond =
B.CreateICmpEQ(Mbcnt,
B.getInt32(0));
863 if (NeedResult && ValDivergent && ScanImpl == ScanOptions::Iterative) {
869 B.SetInsertPoint(ComputeEnd);
871 B.Insert(Terminator);
875 B.SetInsertPoint(OriginalBB);
876 B.CreateBr(ComputeLoop);
880 {{DominatorTree::Insert, OriginalBB, ComputeLoop},
881 {DominatorTree::Insert, ComputeLoop, ComputeEnd}});
886 DomTreeUpdates.push_back({DominatorTree::Insert, ComputeEnd, Succ});
887 DomTreeUpdates.push_back({DominatorTree::Delete, OriginalBB, Succ});
892 Predecessor = ComputeEnd;
894 Predecessor = OriginalBB;
897 B.SetInsertPoint(SingleLaneTerminator);
907 B.SetInsertPoint(&
I);
911 PHINode *
const PHI =
B.CreatePHI(Ty, 2);
913 PHI->addIncoming(NewI, SingleLaneTerminator->
getParent());
920 ReadlaneVal =
B.CreateZExt(
PHI,
B.getInt32Ty());
922 Value *BroadcastI =
B.CreateIntrinsic(
923 ReadlaneVal->
getType(), Intrinsic::amdgcn_readfirstlane, ReadlaneVal);
925 BroadcastI =
B.CreateTrunc(BroadcastI, Ty);
931 Value *LaneOffset =
nullptr;
933 if (ScanImpl == ScanOptions::DPP) {
935 B.CreateIntrinsic(Intrinsic::amdgcn_strict_wwm, Ty, ExclScan);
936 }
else if (ScanImpl == ScanOptions::Iterative) {
937 LaneOffset = ExclScan;
942 Mbcnt = isAtomicFloatingPointTy ?
B.CreateUIToFP(Mbcnt, Ty)
943 :
B.CreateIntCast(Mbcnt, Ty,
false);
959 LaneOffset =
B.CreateSelect(
Cond, Identity,
V);
962 LaneOffset =
buildMul(
B,
V,
B.CreateAnd(Mbcnt, 1));
966 LaneOffset =
B.CreateFMul(
V, Mbcnt);
972 if (isAtomicFloatingPointTy) {
990 PHINode *
const PHI =
B.CreatePHI(Ty, 2);
992 PHI->addIncoming(Result,
I.getParent());
993 I.replaceAllUsesWith(
PHI);
996 I.replaceAllUsesWith(Result);
1001 I.eraseFromParent();
1005 "AMDGPU atomic optimizations",
false,
false)
1012 return new AMDGPUAtomicOptimizer(ScanStrategy);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static Constant * getIdentityValueForAtomicOp(Type *const Ty, AtomicRMWInst::BinOp Op)
static bool isLegalCrossLaneType(Type *Ty)
static Value * buildMul(IRBuilder<> &B, Value *LHS, Value *RHS)
static Value * buildNonAtomicBinOp(IRBuilder<> &B, AtomicRMWInst::BinOp Op, Value *LHS, Value *RHS)
static Intrinsic::ID getWaveReductionIntrinsic(AtomicRMWInst::BinOp Op)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static bool runOnFunction(Function &F, bool PostInlining)
AMD GCN specific subclass of TargetSubtarget.
Machine Check Debug Module
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
const SmallVectorImpl< MachineOperand > & Cond
static void visit(BasicBlock &Start, std::function< bool(BasicBlock *)> op)
Target-Independent Code Generator Pass Configuration Options pass.
bool isSingleLaneExecution(const Function &Kernel) const
Return true if only a single workitem can be active in a wave.
unsigned getWavefrontSize() const
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, uint64_t payload=0)
Factory for NaN values.
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
Factory for Positive and Negative Zero.
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
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()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
an instruction that atomically reads a memory location, combines it with another value,...
static bool isFPOperation(BinOp Op)
BinOp
This enumeration lists the possible modifications atomicrmw can make.
@ Min
*p = old <signed v ? old : v
@ Max
*p = old >signed v ? old : v
@ UMin
*p = old <unsigned v ? old : v
@ FMin
*p = minnum(old, v) minnum matches the behavior of llvm.minnum.
@ UMax
*p = old >unsigned v ? old : v
@ FMax
*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
LLVM_ABI InstListType::const_iterator getFirstNonPHIIt() const
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ ICMP_SLT
signed less than
@ ICMP_UGT
unsigned greater than
@ ICMP_SGT
signed greater than
@ ICMP_ULT
unsigned less than
This is the shared class of boolean and integer constants.
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Analysis pass which computes a DominatorTree.
Legacy analysis pass which computes a DominatorTree.
DominatorTree & getDomTree()
FunctionPass class - This class is used to implement most global optimizations.
bool hasPermLane64() const
void applyUpdates(ArrayRef< UpdateT > Updates)
Submit updates to all available trees.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Base class for instruction visitors.
A wrapper class for inspecting calls to intrinsic functions.
This is an important class for using LLVM in a threaded context.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
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.
TMC & getTM() const
Get the right type of TargetMachine for this target.
The instances of the Type class are immutable: once they are created, they are never changed.
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ DoubleTyID
64-bit floating point type
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
void setOperand(unsigned i, Value *Val)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
const ParentTy * getParent() const
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ LOCAL_ADDRESS
Address space for local memory.
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ AMDGPU_PS
Used for Mesa/AMDPAL pixel shaders.
@ BasicBlock
Various leaf nodes.
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
GenericUniformityInfo< SSAContext > UniformityInfo
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
FunctionPass * createAMDGPUAtomicOptimizerPass(ScanOptions ScanStrategy)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
IRBuilder(LLVMContext &, FolderTy, InserterTy, MDNode *, ArrayRef< OperandBundleDef >) -> IRBuilder< FolderTy, InserterTy >
DWARFExpression::Operation Op
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
char & AMDGPUAtomicOptimizerID
LLVM_ABI Instruction * SplitBlockAndInsertIfThen(Value *Cond, BasicBlock::iterator SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)