LLVM: lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "amdgpu-promote-alloca"
Functions
INITIALIZE_PASS_BEGIN (AMDGPUPromoteAlloca, DEBUG_TYPE, "AMDGPU promote alloca to vector or LDS", false, false) INITIALIZE_PASS_END(AMDGPUPromoteAlloca
static void collectAllocaUses (AllocaInst &Alloca, SmallVectorImpl< Use * > &Uses)
static bool isSupportedMemset (MemSetInst *I, AllocaInst *AI, const DataLayout &DL)
static Value * calculateVectorIndex (Value *Ptr, const std::map< GetElementPtrInst *, WeakTrackingVH > &GEPIdx)
static Value * GEPToVectorIndex (GetElementPtrInst *GEP, AllocaInst *Alloca, Type *VecElemTy, const DataLayout &DL, SmallVector< Instruction * > &NewInsts)
static Value * promoteAllocaUserToVector (Instruction *Inst, const DataLayout &DL, FixedVectorType *VectorTy, unsigned VecStoreSize, unsigned ElementSize, DenseMap< MemTransferInst *, MemTransferInfo > &TransferInfo, std::map< GetElementPtrInst *, WeakTrackingVH > &GEPVectorIdx, function_ref< Value *()> GetCurVal)
Promotes a single user of the alloca to a vector form.
static bool isSupportedAccessType (FixedVectorType *VecTy, Type *AccessTy, const DataLayout &DL)
template
static void forEachWorkListItem (const InstContainer &WorkList, std::function< void(Instruction *)> Fn)
Iterates over an instruction worklist that may contain multiple instructions from the same basic block, but in a different order.
static BasicBlock::iterator skipToNonAllocaInsertPt (BasicBlock &BB, BasicBlock::iterator I)
Find an insert point after an alloca, after all other allocas clustered at the start of the block.
static bool isCallPromotable (CallInst *CI)
Variables
DEBUG_TYPE
AMDGPU promote alloca to vector or LDS
AMDGPU promote alloca to vector or false

DEBUG_TYPE

#define DEBUG_TYPE "amdgpu-promote-alloca"

calculateVectorIndex()

collectAllocaUses()

forEachWorkListItem()

template

Iterates over an instruction worklist that may contain multiple instructions from the same basic block, but in a different order.

Definition at line 732 of file AMDGPUPromoteAlloca.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().

GEPToVectorIndex()

Definition at line 405 of file AMDGPUPromoteAlloca.cpp.

References assert(), llvm::cast(), DL, llvm::dyn_cast(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::front(), GEP, llvm::isa(), llvm::APInt::isOne(), llvm::APInt::isZero(), llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::APInt::sdivrem(), llvm::APInt::sextOrTrunc(), and llvm::MapVector< KeyT, ValueT, MapType, VectorType >::size().

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AMDGPUPromoteAlloca ,
DEBUG_TYPE ,
"AMDGPU promote alloca to vector or LDS" ,
false ,
false )

isCallPromotable()

isSupportedAccessType()

isSupportedMemset()

promoteAllocaUserToVector()

Promotes a single user of the alloca to a vector form.

Parameters

Inst Instruction to be promoted.
DL Module Data Layout.
VectorTy Vectorized Type.
VecStoreSize Size of VectorTy in bytes.
ElementSize Size of VectorTy element type in bytes.
TransferInfo MemTransferInst info map.
GEPVectorIdx GEP -> VectorIdx cache.
CurVal Current value of the vector (e.g. last stored value)
[out] DeferredLoads Inst is added to this vector if it can't be promoted now. This happens when promoting requires CurVal, but CurVal is nullptr.

Returns

the stored value if Inst would have written to the alloca, or nullptr otherwise.

Definition at line 502 of file AMDGPUPromoteAlloca.cpp.

References assert(), calculateVectorIndex(), llvm::cast(), MemTransferInfo::DestIndex, DL, llvm::dyn_cast(), llvm::FixedVectorType::get(), llvm::PoisonValue::get(), llvm::Value::getContext(), llvm::VectorType::getElementCount(), llvm::VectorType::getElementType(), llvm::Type::getIntNTy(), getNumElements(), llvm::FixedVectorType::getNumElements(), llvm::Instruction::getOpcode(), llvm::getPointerOperand(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::isa(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isKnownMultipleOf(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), llvm::Length, llvm_unreachable, llvm::PoisonMaskElem, llvm::Value::replaceAllUsesWith(), Size, and MemTransferInfo::SrcIndex.

skipToNonAllocaInsertPt()

DEBUG_TYPE

false

AMDGPU promote alloca to vector or false

LDS

AMDGPU promote alloca to vector or LDS