summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Attributes.cpp19
-rw-r--r--llvm/lib/IR/Core.cpp5
-rw-r--r--llvm/lib/IR/IRBuilder.cpp6
3 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index a68ad50cf2c..dda70f4dc59 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -142,17 +142,14 @@ Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
return Attribute(PA);
}
-Attribute Attribute::getWithAlignment(LLVMContext &Context, uint64_t Align) {
- assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
- assert(Align <= 0x40000000 && "Alignment too large.");
- return get(Context, Alignment, Align);
+Attribute Attribute::getWithAlignment(LLVMContext &Context, Align A) {
+ assert(A <= 0x40000000 && "Alignment too large.");
+ return get(Context, Alignment, A.value());
}
-Attribute Attribute::getWithStackAlignment(LLVMContext &Context,
- uint64_t Align) {
- assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
- assert(Align <= 0x100 && "Alignment too large.");
- return get(Context, StackAlignment, Align);
+Attribute Attribute::getWithStackAlignment(LLVMContext &Context, Align A) {
+ assert(A <= 0x100 && "Alignment too large.");
+ return get(Context, StackAlignment, A.value());
}
Attribute Attribute::getWithDereferenceableBytes(LLVMContext &Context,
@@ -782,10 +779,10 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C, const AttrBuilder &B) {
Attr = Attribute::getWithByValType(C, B.getByValType());
break;
case Attribute::Alignment:
- Attr = Attribute::getWithAlignment(C, B.getAlignment());
+ Attr = Attribute::getWithAlignment(C, Align(B.getAlignment()));
break;
case Attribute::StackAlignment:
- Attr = Attribute::getWithStackAlignment(C, B.getStackAlignment());
+ Attr = Attribute::getWithStackAlignment(C, Align(B.getStackAlignment()));
break;
case Attribute::Dereferenceable:
Attr = Attribute::getWithDereferenceableBytes(
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index afa73b33cd1..a5f46b16e60 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2489,7 +2489,7 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) {
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
Argument *A = unwrap<Argument>(Arg);
- A->addAttr(Attribute::getWithAlignment(A->getContext(), align));
+ A->addAttr(Attribute::getWithAlignment(A->getContext(), Align(align)));
}
/*--.. Operations on ifuncs ................................................--*/
@@ -2788,7 +2788,8 @@ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) {
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
unsigned align) {
auto *Call = unwrap<CallBase>(Instr);
- Attribute AlignAttr = Attribute::getWithAlignment(Call->getContext(), align);
+ Attribute AlignAttr =
+ Attribute::getWithAlignment(Call->getContext(), Align(align));
Call->addAttribute(index, AlignAttr);
}
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index 933b511b604..b782012e973 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -289,8 +289,10 @@ CallInst *IRBuilderBase::CreateElementUnorderedAtomicMemMove(
CallInst *CI = createCallHelper(TheFn, Ops, this);
// Set the alignment of the pointer args.
- CI->addParamAttr(0, Attribute::getWithAlignment(CI->getContext(), DstAlign));
- CI->addParamAttr(1, Attribute::getWithAlignment(CI->getContext(), SrcAlign));
+ CI->addParamAttr(
+ 0, Attribute::getWithAlignment(CI->getContext(), Align(DstAlign)));
+ CI->addParamAttr(
+ 1, Attribute::getWithAlignment(CI->getContext(), Align(SrcAlign)));
// Set the TBAA info if present.
if (TBAATag)
OpenPOWER on IntegriCloud