LLVM 20.0.0git
|
#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/InstSimplifyFolder.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsR600.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
Go to the source code of this file.
Classes | |
struct | MemTransferInfo |
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 | |
AMDGPU promote alloca to vector or false | INITIALIZE_PASS_BEGIN (AMDGPUPromoteAllocaToVector, DEBUG_TYPE "-to-vector", "AMDGPU promote alloca to vector", false, false) INITIALIZE_PASS_END(AMDGPUPromoteAllocaToVector |
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 *, Value * > &GEPIdx) |
static Value * | GEPToVectorIndex (GetElementPtrInst *GEP, AllocaInst *Alloca, Type *VecElemTy, const DataLayout &DL) |
static Value * | promoteAllocaUserToVector (Instruction *Inst, const DataLayout &DL, FixedVectorType *VectorTy, unsigned VecStoreSize, unsigned ElementSize, DenseMap< MemTransferInst *, MemTransferInfo > &TransferInfo, std::map< GetElementPtrInst *, Value * > &GEPVectorIdx, Value *CurVal, SmallVectorImpl< LoadInst * > &DeferredLoads) |
Promotes a single user of the alloca to a vector form. | |
static bool | isSupportedAccessType (FixedVectorType *VecTy, Type *AccessTy, const DataLayout &DL) |
template<typename InstContainer > | |
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 bool | isCallPromotable (CallInst *CI) |
Variables | |
DEBUG_TYPE | |
AMDGPU promote alloca to vector or | LDS |
AMDGPU promote alloca to vector or | false |
AMDGPU promote alloca to vector or false DEBUG_TYPE to | vector |
#define DEBUG_TYPE "amdgpu-promote-alloca" |
Definition at line 48 of file AMDGPUPromoteAlloca.cpp.
|
static |
Definition at line 389 of file AMDGPUPromoteAlloca.cpp.
References assert(), GEP, llvm::Type::getInt32Ty(), llvm::Constant::getNullValue(), I, and Ptr.
Referenced by promoteAllocaUserToVector().
|
static |
Definition at line 252 of file AMDGPUPromoteAlloca.cpp.
References llvm::SmallVectorImpl< T >::pop_back_val(), and Uses.
|
static |
Iterates over an instruction worklist that may contain multiple instructions from the same basic block, but in a different order.
Definition at line 690 of file AMDGPUPromoteAlloca.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().
|
static |
Definition at line 400 of file AMDGPUPromoteAlloca.cpp.
References DL, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::front(), GEP, llvm::APInt::isZero(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::size(), and llvm::APInt::udivrem().
INITIALIZE_PASS_BEGIN | ( | AMDGPUPromoteAlloca | , |
DEBUG_TYPE | , | ||
"AMDGPU promote alloca to vector or LDS" | , | ||
false | , | ||
false | |||
) |
AMDGPU promote alloca to vector or false INITIALIZE_PASS_BEGIN | ( | AMDGPUPromoteAllocaToVector | , |
DEBUG_TYPE "-to-vector" | , | ||
"AMDGPU promote alloca to vector" | , | ||
false | , | ||
false | |||
) |
Definition at line 1095 of file AMDGPUPromoteAlloca.cpp.
References II.
|
static |
Definition at line 664 of file AMDGPUPromoteAlloca.cpp.
References DL, llvm::VectorType::getElementType(), llvm::CastInst::isBitOrNoopPointerCastable(), and llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isKnownMultipleOf().
|
static |
Definition at line 374 of file AMDGPUPromoteAlloca.cpp.
References DL, llvm::AllocaInst::getAllocatedType(), I, llvm::PatternMatch::m_SpecificInt(), llvm::PatternMatch::match(), and Size.
|
static |
Promotes a single user of the alloca to a vector form.
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. |
Inst
would have written to the alloca, or nullptr otherwise. Definition at line 448 of file AMDGPUPromoteAlloca.cpp.
References assert(), calculateVectorIndex(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateBitOrPointerCast(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateIntToPtr(), llvm::IRBuilderBase::CreateLoad(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::IRBuilderBase::CreateVectorSplat(), MemTransferInfo::DestIndex, DL, llvm::FixedVectorType::get(), llvm::PoisonValue::get(), llvm::Value::getContext(), llvm::VectorType::getElementCount(), llvm::VectorType::getElementType(), llvm::IRBuilderBase::getIntN(), llvm::IRBuilderBase::getIntNTy(), llvm::FixedVectorType::getNumElements(), llvm::Instruction::getOpcode(), llvm::getPointerOperand(), llvm::IRBuilderBase::getPtrTy(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), Idx, Intr, llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isKnownMultipleOf(), llvm::Type::isPointerTy(), llvm::Type::isPtrOrPtrVectorTy(), llvm::Length, llvm_unreachable, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::IRBuilderBase::SetInsertPoint(), Size, and MemTransferInfo::SrcIndex.
DEBUG_TYPE |
Definition at line 208 of file AMDGPUPromoteAlloca.cpp.
AMDGPU promote alloca to vector or false DEBUG_TYPE to AMDGPU promote alloca to false |
Definition at line 209 of file AMDGPUPromoteAlloca.cpp.
AMDGPU promote alloca to vector or LDS |
Definition at line 209 of file AMDGPUPromoteAlloca.cpp.
Referenced by llvm::AMDGPUTargetLowering::getTargetNodeName().
AMDGPU promote alloca to vector or false DEBUG_TYPE to AMDGPU promote alloca to vector |
Definition at line 214 of file AMDGPUPromoteAlloca.cpp.
Referenced by llvm::LLT::fixed_vector(), and llvm::LLT::scalable_vector().