summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-12-13 17:54:50 +0100
committerGuillaume Chatelet <gchatelet@google.com>2019-12-16 13:35:55 +0100
commit181ab91efc9fb08dedda10a2fbc5fccb83ce8799 (patch)
treed08c95420eebd4e8b5986e63caf9f3b7db0732ca /llvm/lib/IR
parentc41d2b5ab2829d05268e9bbcf2f54756de445e57 (diff)
downloadbcm5719-llvm-181ab91efc9fb08dedda10a2fbc5fccb83ce8799.tar.gz
bcm5719-llvm-181ab91efc9fb08dedda10a2fbc5fccb83ce8799.zip
[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove
Summary: This patch introduces a set of functions to enable deprecation of IRBuilder functions without breaking out of tree clients. Functions will be deprecated one by one and as in tree code is cleaned up. 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, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71473
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Core.cpp8
-rw-r--r--llvm/lib/IR/Function.cpp5
-rw-r--r--llvm/lib/IR/Instructions.cpp18
3 files changed, 14 insertions, 17 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 84e279b8bbc..63b98f26ba1 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -3450,8 +3450,8 @@ LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B,
LLVMValueRef Dst, unsigned DstAlign,
LLVMValueRef Src, unsigned SrcAlign,
LLVMValueRef Size) {
- return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), DstAlign,
- unwrap(Src), SrcAlign,
+ return wrap(unwrap(B)->CreateMemCpy(unwrap(Dst), MaybeAlign(DstAlign),
+ unwrap(Src), MaybeAlign(SrcAlign),
unwrap(Size)));
}
@@ -3459,8 +3459,8 @@ LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B,
LLVMValueRef Dst, unsigned DstAlign,
LLVMValueRef Src, unsigned SrcAlign,
LLVMValueRef Size) {
- return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), DstAlign,
- unwrap(Src), SrcAlign,
+ return wrap(unwrap(B)->CreateMemMove(unwrap(Dst), MaybeAlign(DstAlign),
+ unwrap(Src), MaybeAlign(SrcAlign),
unwrap(Size)));
}
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index fcf893bd4a3..54612250b0d 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -126,6 +126,11 @@ unsigned Argument::getParamAlignment() const {
return getParent()->getParamAlignment(getArgNo());
}
+MaybeAlign Argument::getParamAlign() const {
+ assert(getType()->isPointerTy() && "Only pointers have alignments");
+ return getParent()->getParamAlign(getArgNo());
+}
+
Type *Argument::getParamByValType() const {
assert(getType()->isPointerTy() && "Only pointers have byval types");
return getParent()->getParamByValType(getArgNo());
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 2a49a758a46..c264277fa53 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1342,11 +1342,7 @@ void LoadInst::setAlignment(MaybeAlign Align) {
"Alignment is greater than MaximumAlignment!");
setInstructionSubclassData((getSubclassDataFromInstruction() & ~(31 << 1)) |
(encode(Align) << 1));
- if (Align)
- assert(getAlignment() == Align->value() &&
- "Alignment representation error!");
- else
- assert(getAlignment() == 0 && "Alignment representation error!");
+ assert(getAlign() == Align && "Alignment representation error!");
}
//===----------------------------------------------------------------------===//
@@ -1416,16 +1412,12 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, MaybeAlign Align,
AssertOK();
}
-void StoreInst::setAlignment(MaybeAlign Align) {
- assert((!Align || *Align <= MaximumAlignment) &&
+void StoreInst::setAlignment(MaybeAlign Alignment) {
+ assert((!Alignment || *Alignment <= MaximumAlignment) &&
"Alignment is greater than MaximumAlignment!");
setInstructionSubclassData((getSubclassDataFromInstruction() & ~(31 << 1)) |
- (encode(Align) << 1));
- if (Align)
- assert(getAlignment() == Align->value() &&
- "Alignment representation error!");
- else
- assert(getAlignment() == 0 && "Alignment representation error!");
+ (encode(Alignment) << 1));
+ assert(getAlign() == Alignment && "Alignment representation error!");
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud