summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-12-09 17:36:50 +0100
committerGuillaume Chatelet <gchatelet@google.com>2019-12-10 15:17:44 +0100
commit1b2842bf902a8b52acbef2425120533b63be5ae3 (patch)
treef3e2d677e3efb5acde068e69f28fb84741978560 /llvm/lib/IR
parent707e9707814bfbb0297be4ab1bd4f976aa44ed37 (diff)
downloadbcm5719-llvm-1b2842bf902a8b52acbef2425120533b63be5ae3.tar.gz
bcm5719-llvm-1b2842bf902a8b52acbef2425120533b63be5ae3.zip
[Alignment][NFC] CreateMemSet use MaybeAlign
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: arsenm, jvesely, nhaehnle, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71213
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Core.cpp3
-rw-r--r--llvm/lib/IR/IRBuilder.cpp12
2 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index fa8d2acd963..84e279b8bbc 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -3442,7 +3442,8 @@ LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty,
LLVMValueRef LLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr,
LLVMValueRef Val, LLVMValueRef Len,
unsigned Align) {
- return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len), Align));
+ return wrap(unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Len),
+ MaybeAlign(Align)));
}
LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B,
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index b782012e973..c424e845f48 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -96,10 +96,10 @@ static InvokeInst *createInvokeHelper(Function *Invokee, BasicBlock *NormalDest,
return II;
}
-CallInst *IRBuilderBase::
-CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
- bool isVolatile, MDNode *TBAATag, MDNode *ScopeTag,
- MDNode *NoAliasTag) {
+CallInst *IRBuilderBase::CreateMemSet(Value *Ptr, Value *Val, Value *Size,
+ MaybeAlign Align, bool isVolatile,
+ MDNode *TBAATag, MDNode *ScopeTag,
+ MDNode *NoAliasTag) {
Ptr = getCastedInt8PtrValue(Ptr);
Value *Ops[] = {Ptr, Val, Size, getInt1(isVolatile)};
Type *Tys[] = { Ptr->getType(), Size->getType() };
@@ -108,8 +108,8 @@ CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
CallInst *CI = createCallHelper(TheFn, Ops, this);
- if (Align > 0)
- cast<MemSetInst>(CI)->setDestAlignment(Align);
+ if (Align)
+ cast<MemSetInst>(CI)->setDestAlignment(Align->value());
// Set the TBAA info if present.
if (TBAATag)
OpenPOWER on IntegriCloud