diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index 3e9dcca114a3..14958a180ce3 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -37,6 +37,8 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Intrinsics.h" +#include "llvm/IR/IntrinsicsAMDGPU.h" +#include "llvm/IR/IntrinsicsR600.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" @@ -268,21 +270,21 @@ AMDGPUPromoteAlloca::getLocalSizeYZ(IRBuilder<> &Builder) { Value *AMDGPUPromoteAlloca::getWorkitemID(IRBuilder<> &Builder, unsigned N) { const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(*TM, *Builder.GetInsertBlock()->getParent()); - Intrinsic::ID IntrID = Intrinsic::ID::not_intrinsic; + Intrinsic::ID IntrID = Intrinsic::not_intrinsic; switch (N) { case 0: - IntrID = IsAMDGCN ? Intrinsic::amdgcn_workitem_id_x - : Intrinsic::r600_read_tidig_x; + IntrID = IsAMDGCN ? (Intrinsic::ID)Intrinsic::amdgcn_workitem_id_x + : (Intrinsic::ID)Intrinsic::r600_read_tidig_x; break; case 1: - IntrID = IsAMDGCN ? Intrinsic::amdgcn_workitem_id_y - : Intrinsic::r600_read_tidig_y; + IntrID = IsAMDGCN ? (Intrinsic::ID)Intrinsic::amdgcn_workitem_id_y + : (Intrinsic::ID)Intrinsic::r600_read_tidig_y; break; case 2: - IntrID = IsAMDGCN ? Intrinsic::amdgcn_workitem_id_z - : Intrinsic::r600_read_tidig_z; + IntrID = IsAMDGCN ? (Intrinsic::ID)Intrinsic::amdgcn_workitem_id_z + : (Intrinsic::ID)Intrinsic::r600_read_tidig_z; break; default: llvm_unreachable("invalid dimension"); @@ -648,7 +650,7 @@ bool AMDGPUPromoteAlloca::hasSufficientLocalMem(const Function &F) { // Check how much local memory is being used by global objects CurrentLocalMemUsage = 0; for (GlobalVariable &GV : Mod->globals()) { - if (GV.getType()->getAddressSpace() != AMDGPUAS::LOCAL_ADDRESS) + if (GV.getAddressSpace() != AMDGPUAS::LOCAL_ADDRESS) continue; for (const User *U : GV.users()) { @@ -882,25 +884,25 @@ bool AMDGPUPromoteAlloca::handleAlloca(AllocaInst &I, bool SufficientLDS) { continue; case Intrinsic::memcpy: { MemCpyInst *MemCpy = cast<MemCpyInst>(Intr); - Builder.CreateMemCpy(MemCpy->getRawDest(), MemCpy->getDestAlignment(), - MemCpy->getRawSource(), MemCpy->getSourceAlignment(), + Builder.CreateMemCpy(MemCpy->getRawDest(), MemCpy->getDestAlign(), + MemCpy->getRawSource(), MemCpy->getSourceAlign(), MemCpy->getLength(), MemCpy->isVolatile()); Intr->eraseFromParent(); continue; } case Intrinsic::memmove: { MemMoveInst *MemMove = cast<MemMoveInst>(Intr); - Builder.CreateMemMove(MemMove->getRawDest(), MemMove->getDestAlignment(), - MemMove->getRawSource(), MemMove->getSourceAlignment(), + Builder.CreateMemMove(MemMove->getRawDest(), MemMove->getDestAlign(), + MemMove->getRawSource(), MemMove->getSourceAlign(), MemMove->getLength(), MemMove->isVolatile()); Intr->eraseFromParent(); continue; } case Intrinsic::memset: { MemSetInst *MemSet = cast<MemSetInst>(Intr); - Builder.CreateMemSet(MemSet->getRawDest(), MemSet->getValue(), - MemSet->getLength(), MemSet->getDestAlignment(), - MemSet->isVolatile()); + Builder.CreateMemSet( + MemSet->getRawDest(), MemSet->getValue(), MemSet->getLength(), + MaybeAlign(MemSet->getDestAlignment()), MemSet->isVolatile()); Intr->eraseFromParent(); continue; } |