[Alignment][NFC] Align compatible methods for CreateElementUnorderedAtomicMemSet

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: hiraditya, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71703
This commit is contained in:
Guillaume Chatelet 2019-12-19 15:41:05 +01:00
parent 1edb3ea645
commit b4982d6ecd
2 changed files with 31 additions and 7 deletions

View File

@ -468,19 +468,45 @@ 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.
/// FIXME: Remove this function once transition to Align is over.
/// Use the version that takes Align instead of this one.
LLVM_ATTRIBUTE_DEPRECATED(
CallInst *CreateElementUnorderedAtomicMemSet(
Value *Ptr, Value *Val, uint64_t Size, unsigned Alignment,
uint32_t ElementSize, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr, MDNode *NoAliasTag = nullptr),
"Use the version that takes Align instead of this one") {
return CreateElementUnorderedAtomicMemSet(Ptr, Val, getInt64(Size),
Align(Alignment), ElementSize,
TBAATag, ScopeTag, NoAliasTag);
}
CallInst *CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val,
uint64_t Size, unsigned Align,
uint64_t Size, Align Alignment,
uint32_t ElementSize,
MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,
MDNode *NoAliasTag = nullptr) {
return CreateElementUnorderedAtomicMemSet(Ptr, Val, getInt64(Size), Align,
return CreateElementUnorderedAtomicMemSet(Ptr, Val, getInt64(Size),
Align(Alignment), ElementSize,
TBAATag, ScopeTag, NoAliasTag);
}
/// FIXME: Remove this function once transition to Align is over.
/// Use the version that takes Align instead of this one.
LLVM_ATTRIBUTE_DEPRECATED(
CallInst *CreateElementUnorderedAtomicMemSet(
Value *Ptr, Value *Val, Value *Size, unsigned Alignment,
uint32_t ElementSize, MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr, MDNode *NoAliasTag = nullptr),
"Use the version that takes Align instead of this one") {
return CreateElementUnorderedAtomicMemSet(Ptr, Val, Size, Align(Alignment),
ElementSize, TBAATag, ScopeTag,
NoAliasTag);
}
CallInst *CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val,
Value *Size, unsigned Align,
Value *Size, Align Alignment,
uint32_t ElementSize,
MDNode *TBAATag = nullptr,
MDNode *ScopeTag = nullptr,

View File

@ -125,10 +125,8 @@ CallInst *IRBuilderBase::CreateMemSet(Value *Ptr, Value *Val, Value *Size,
}
CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemSet(
Value *Ptr, Value *Val, Value *Size, unsigned Align, uint32_t ElementSize,
Value *Ptr, Value *Val, Value *Size, Align Alignment, uint32_t ElementSize,
MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) {
assert(Align >= ElementSize &&
"Pointer alignment must be at least element size.");
Ptr = getCastedInt8PtrValue(Ptr);
Value *Ops[] = {Ptr, Val, Size, getInt32(ElementSize)};
@ -139,7 +137,7 @@ CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemSet(
CallInst *CI = createCallHelper(TheFn, Ops, this);
cast<AtomicMemSetInst>(CI)->setDestAlignment(Align);
cast<AtomicMemSetInst>(CI)->setDestAlignment(Alignment);
// Set the TBAA info if present.
if (TBAATag)