Skip to content

Commit

Permalink
[NFC] Cleanup/remove some AttributeList setter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aeubanks committed Aug 20, 2021
1 parent 25599c3 commit d7df812
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
26 changes: 2 additions & 24 deletions llvm/include/llvm/IR/Attributes.h
Expand Up @@ -665,39 +665,17 @@ class AttributeList {
LLVM_NODISCARD AttributeList addDereferenceableParamAttr(
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;

/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given index. Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr(
LLVMContext &C, unsigned Index, uint64_t Bytes) const;

/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given arg index. Returns a new list because attribute lists are
/// immutable.
LLVM_NODISCARD AttributeList addDereferenceableOrNullParamAttr(
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
return addDereferenceableOrNullAttr(C, ArgNo + FirstArgIndex, Bytes);
}

/// Add the allocsize attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList
addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg);
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;

/// Add the allocsize attribute to the attribute set at the given arg index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList
addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
return addAllocSizeAttr(C, ArgNo + FirstArgIndex, ElemSizeArg, NumElemsArg);
}

/// Add the vscale_range attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList addVScaleRangeAttr(LLVMContext &C,
unsigned Index,
unsigned MinValue,
unsigned MaxValue);
const Optional<unsigned> &NumElemsArg);

//===--------------------------------------------------------------------===//
// AttributeList Accessors
Expand Down
22 changes: 7 additions & 15 deletions llvm/lib/IR/Attributes.cpp
Expand Up @@ -1351,28 +1351,20 @@ AttributeList AttributeList::addDereferenceableParamAttr(LLVMContext &C,
}

AttributeList
AttributeList::addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index,
uint64_t Bytes) const {
AttributeList::addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned Index,
uint64_t Bytes) const {
AttrBuilder B;
B.addDereferenceableOrNullAttr(Bytes);
return addAttributes(C, Index, B);
return addParamAttributes(C, Index, B);
}

AttributeList
AttributeList::addAllocSizeAttr(LLVMContext &C, unsigned Index,
unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
AttributeList::addAllocSizeParamAttr(LLVMContext &C, unsigned Index,
unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
AttrBuilder B;
B.addAllocSizeAttr(ElemSizeArg, NumElemsArg);
return addAttributes(C, Index, B);
}

AttributeList AttributeList::addVScaleRangeAttr(LLVMContext &C, unsigned Index,
unsigned MinValue,
unsigned MaxValue) {
AttrBuilder B;
B.addVScaleRangeAttr(MinValue, MaxValue);
return addAttributes(C, Index, B);
return addParamAttributes(C, Index, B);
}

//===----------------------------------------------------------------------===//
Expand Down

0 comments on commit d7df812

Please sign in to comment.