diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-02 20:28:10 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-02 20:28:10 +0000 |
| commit | 7e747f1a387281aa3d95944afcb1aa19dc6ca209 (patch) | |
| tree | 8286133cd3444214b31d90d28c0587092ff78dfd /llvm/lib | |
| parent | 025d59b16a643154fa1a8e0cad3dd9f04c153c6e (diff) | |
| download | bcm5719-llvm-7e747f1a387281aa3d95944afcb1aa19dc6ca209.tar.gz bcm5719-llvm-7e747f1a387281aa3d95944afcb1aa19dc6ca209.zip | |
AMDGPU: Handle promoting memmove
Also add missing tests for the others.
llvm-svn: 259558
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index f17317deacb..d22fa323521 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -406,12 +406,14 @@ static bool isCallPromotable(CallInst *CI) { switch (II->getIntrinsicID()) { case Intrinsic::memcpy: + case Intrinsic::memmove: case Intrinsic::memset: case Intrinsic::lifetime_start: case Intrinsic::lifetime_end: case Intrinsic::invariant_start: case Intrinsic::invariant_end: case Intrinsic::invariant_group_barrier: + case Intrinsic::objectsize: return true; default: return false; @@ -572,6 +574,14 @@ void AMDGPUPromoteAlloca::visitAlloca(AllocaInst &I) { Intr->eraseFromParent(); continue; } + case Intrinsic::memmove: { + MemMoveInst *MemMove = cast<MemMoveInst>(Intr); + Builder.CreateMemMove(MemMove->getRawDest(), MemMove->getRawSource(), + MemMove->getLength(), MemMove->getAlignment(), + MemMove->isVolatile()); + Intr->eraseFromParent(); + continue; + } case Intrinsic::memset: { MemSetInst *MemSet = cast<MemSetInst>(Intr); Builder.CreateMemSet(MemSet->getRawDest(), MemSet->getValue(), @@ -588,6 +598,20 @@ void AMDGPUPromoteAlloca::visitAlloca(AllocaInst &I) { // but the intrinsics need to be changed to accept pointers with any // address space. continue; + case Intrinsic::objectsize: { + Value *Src = Intr->getOperand(0); + Type *SrcTy = Src->getType()->getPointerElementType(); + Function *ObjectSize = Intrinsic::getDeclaration(Mod, + Intrinsic::objectsize, + { Intr->getType(), PointerType::get(SrcTy, AMDGPUAS::LOCAL_ADDRESS) } + ); + + CallInst *NewCall + = Builder.CreateCall(ObjectSize, { Src, Intr->getOperand(1) }); + Intr->replaceAllUsesWith(NewCall); + Intr->eraseFromParent(); + continue; + } default: Intr->dump(); llvm_unreachable("Don't know how to promote alloca intrinsic use."); |

