diff options
| author | Anna Thomas <anna@azul.com> | 2016-07-22 20:57:23 +0000 |
|---|---|---|
| committer | Anna Thomas <anna@azul.com> | 2016-07-22 20:57:23 +0000 |
| commit | 58d1192a2277d1a765ba99474815d20d171e35dd (patch) | |
| tree | 91709aa0588d943c53c8e77e6c152dbfb728b2b7 /llvm/lib | |
| parent | fea2139740e94953749b030b8c1e5b75f9a308b4 (diff) | |
| download | bcm5719-llvm-58d1192a2277d1a765ba99474815d20d171e35dd.tar.gz bcm5719-llvm-58d1192a2277d1a765ba99474815d20d171e35dd.zip | |
Add invariant start call creation in IRBuilder.NFC
Differential Revision: https://reviews.llvm.org/D22700
llvm-svn: 276471
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/IRBuilder.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp index 298331d51c8..d3e410d6d03 100644 --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -191,6 +191,26 @@ CallInst *IRBuilderBase::CreateLifetimeEnd(Value *Ptr, ConstantInt *Size) { return createCallHelper(TheFn, Ops, this); } +CallInst *IRBuilderBase::CreateInvariantStart(Value *Ptr, ConstantInt *Size) { + + assert(isa<PointerType>(Ptr->getType()) && + "invariant.start only applies to pointers."); + Ptr = getCastedInt8PtrValue(Ptr); + if (!Size) + Size = getInt64(-1); + else + assert(Size->getType() == getInt64Ty() && + "invariant.start requires the size to be an i64"); + + Value *Ops[] = {Size, Ptr}; + // Fill in the single overloaded type: memory object type. + Type *ObjectPtr[1] = {Ptr->getType()}; + Module *M = BB->getParent()->getParent(); + Value *TheFn = + Intrinsic::getDeclaration(M, Intrinsic::invariant_start, ObjectPtr); + return createCallHelper(TheFn, Ops, this); +} + CallInst *IRBuilderBase::CreateAssumption(Value *Cond) { assert(Cond->getType() == getInt1Ty() && "an assumption condition must be of type i1"); |

