summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-11-19 05:56:52 +0000
committerPete Cooper <peter_cooper@apple.com>2015-11-19 05:56:52 +0000
commit67cf9a723ba5cf0a711efcb317b241104b558779 (patch)
treee362be29f8f95e45470715ea59a93f2b8ad86de9 /llvm/include
parent3b39e88ae0e1f260ebb89f874d8006cb0b87fd2f (diff)
downloadbcm5719-llvm-67cf9a723ba5cf0a711efcb317b241104b558779.tar.gz
bcm5719-llvm-67cf9a723ba5cf0a711efcb317b241104b558779.zip
Revert "Change memcpy/memset/memmove to have dest and source alignments."
This reverts commit r253511. This likely broke the bots in http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202 http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787 llvm-svn: 253543
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/IR/IRBuilder.h45
-rw-r--r--llvm/include/llvm/IR/Instructions.h17
-rw-r--r--llvm/include/llvm/IR/IntrinsicInst.h32
-rw-r--r--llvm/include/llvm/IR/Intrinsics.td6
4 files changed, 27 insertions, 73 deletions
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 4936ccb417d..a9e040b825c 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -362,56 +362,34 @@ public:
/// If the pointer isn't an i8*, it will be converted. If a TBAA tag is
/// specified, it will be added to the instruction. Likewise with alias.scope
/// and noalias tags.
- CallInst *CreateMemSet(Value *Ptr, Value *Val, uint64_t Size,
- unsigned DstAlign,
+ CallInst *CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr) {
- return CreateMemSet(Ptr, Val, getInt64(Size), DstAlign, isVolatile,
+ return CreateMemSet(Ptr, Val, getInt64(Size), Align, isVolatile,
TBAATag, ScopeTag, NoAliasTag);
}
- CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned DstAlign,
+ CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr);
- /// Create and insert a memcpy between the specified pointers.
+ /// \brief Create and insert a memcpy between the specified pointers.
///
/// If the pointers aren't i8*, they will be converted. If a TBAA tag is
/// specified, it will be added to the instruction. Likewise with alias.scope
/// and noalias tags.
- ///
- /// Note! This is very temporary. It is only intended to catch calls to
- /// CreateMemCpy in out of tree code which would otherwise silently pass the
- /// volatile flag to source alignment.
- class IntegerAlignment {
- private:
- uint64_t Align;
-
- IntegerAlignment() = delete;
- IntegerAlignment(bool) = delete;
- public:
- IntegerAlignment(int Align) : Align(Align) { }
- IntegerAlignment(long long Align) : Align(Align) { }
- IntegerAlignment(unsigned Align) : Align(Align) { }
- IntegerAlignment(uint64_t Align) : Align(Align) { }
-
- operator unsigned() { return Align; }
- };
- CallInst *CreateMemCpy(Value *Dst, Value *Src, uint64_t Size,
- unsigned DstAlign, IntegerAlignment SrcAlign,
+ CallInst *CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *TBAAStructTag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr) {
- return CreateMemCpy(Dst, Src, getInt64(Size), DstAlign, SrcAlign,
- isVolatile, TBAATag,
+ return CreateMemCpy(Dst, Src, getInt64(Size), Align, isVolatile, TBAATag,
TBAAStructTag, ScopeTag, NoAliasTag);
}
- CallInst *CreateMemCpy(Value *Dst, Value *Src, Value *Size,
- unsigned DstAlign, IntegerAlignment SrcAlign,
+ CallInst *CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *TBAAStructTag = nullptr,
MDNode *ScopeTag = nullptr,
@@ -423,18 +401,15 @@ public:
/// If the pointers aren't i8*, they will be converted. If a TBAA tag is
/// specified, it will be added to the instruction. Likewise with alias.scope
/// and noalias tags.
- CallInst *CreateMemMove(Value *Dst, Value *Src, uint64_t Size,
- unsigned DstAlign, IntegerAlignment SrcAlign,
+ CallInst *CreateMemMove(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr) {
- return CreateMemMove(Dst, Src, getInt64(Size), DstAlign, SrcAlign,
- isVolatile,
+ return CreateMemMove(Dst, Src, getInt64(Size), Align, isVolatile,
TBAATag, ScopeTag, NoAliasTag);
}
- CallInst *CreateMemMove(Value *Dst, Value *Src, Value *Size,
- unsigned DstAlign, IntegerAlignment SrcAlign,
+ CallInst *CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr);
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 51b06133378..a5a48cb30b0 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1638,23 +1638,6 @@ public:
return AttributeList.getParamAlignment(i);
}
- /// Set the alignment for a call or parameter (0=unknown).
- void setParamAlignment(unsigned Index, unsigned Align) {
- // Its not valid to change the parameter alignment. Instead we have to
- // remove the old one if its there, and add a new one.
- if (AttributeList.hasAttribute(Index, Attribute::Alignment))
- AttributeList = AttributeList.removeAttribute(getContext(),
- Index,
- Attribute::Alignment);
-
- // Now add the new alignment.
- llvm::AttrBuilder B;
- B.addAlignmentAttr(Align);
- AttributeList = AttributeList.addAttributes(getContext(), Index,
- AttributeSet::get(getContext(),
- Index, B));
- }
-
/// \brief Extract the number of dereferenceable bytes for a call or
/// parameter (0=unknown).
uint64_t getDereferenceableBytes(unsigned i) const {
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index ba75e4ca8de..169bcc02198 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -150,13 +150,16 @@ namespace llvm {
const Use &getLengthUse() const { return getArgOperandUse(2); }
Use &getLengthUse() { return getArgOperandUse(2); }
- unsigned getDestAlignment() const {
- // Note, param attributes start at 1, so offset dest index from 0 to 1.
- return getParamAlignment(1);
+ ConstantInt *getAlignmentCst() const {
+ return cast<ConstantInt>(const_cast<Value*>(getArgOperand(3)));
+ }
+
+ unsigned getAlignment() const {
+ return getAlignmentCst()->getZExtValue();
}
ConstantInt *getVolatileCst() const {
- return cast<ConstantInt>(const_cast<Value*>(getArgOperand(3)));
+ return cast<ConstantInt>(const_cast<Value*>(getArgOperand(4)));
}
bool isVolatile() const {
return !getVolatileCst()->isZero();
@@ -185,13 +188,16 @@ namespace llvm {
setArgOperand(2, L);
}
- void setDestAlignment(unsigned Align) {
- // Note, param attributes start at 1, so offset dest index from 0 to 1.
- setParamAlignment(1, Align);
+ void setAlignment(Constant* A) {
+ setArgOperand(3, A);
}
void setVolatile(Constant* V) {
- setArgOperand(3, V);
+ setArgOperand(4, V);
+ }
+
+ Type *getAlignmentType() const {
+ return getArgOperand(3)->getType();
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -253,22 +259,12 @@ namespace llvm {
return cast<PointerType>(getRawSource()->getType())->getAddressSpace();
}
- unsigned getSrcAlignment() const {
- // Note, param attributes start at 1, so offset src index from 1 to 2.
- return getParamAlignment(2);
- }
-
void setSource(Value *Ptr) {
assert(getRawSource()->getType() == Ptr->getType() &&
"setSource called with pointer of wrong type!");
setArgOperand(1, Ptr);
}
- void setSrcAlignment(unsigned Align) {
- // Note, param attributes start at 1, so offset src index from 1 to 2.
- setParamAlignment(2, Align);
- }
-
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::memcpy ||
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 5c14e7de4b0..e7b60ef3d41 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -333,17 +333,17 @@ def int_instrprof_value_profile : Intrinsic<[],
def int_memcpy : Intrinsic<[],
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
- llvm_i1_ty],
+ llvm_i32_ty, llvm_i1_ty],
[IntrReadWriteArgMem, NoCapture<0>, NoCapture<1>,
ReadOnly<1>]>;
def int_memmove : Intrinsic<[],
[llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
- llvm_i1_ty],
+ llvm_i32_ty, llvm_i1_ty],
[IntrReadWriteArgMem, NoCapture<0>, NoCapture<1>,
ReadOnly<1>]>;
def int_memset : Intrinsic<[],
[llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
- llvm_i1_ty],
+ llvm_i32_ty, llvm_i1_ty],
[IntrReadWriteArgMem, NoCapture<0>]>;
let Properties = [IntrNoMem] in {
OpenPOWER on IntegriCloud