Skip to content

Commit 0d822da

Browse files
committed
[NFC] Remove/replace some confusing attribute getters on Function
1 parent 7256c05 commit 0d822da

File tree

4 files changed

+3
-27
lines changed

4 files changed

+3
-27
lines changed

llvm/include/llvm/IR/Function.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,6 @@ class Function : public GlobalObject, public ilist_node<Function> {
440440
/// `undef` or `poison` value is passed from the list of attributes.
441441
void removeParamUndefImplyingAttrs(unsigned ArgNo);
442442

443-
/// check if an attributes is in the list of attributes.
444-
bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const {
445-
return getAttributes().hasAttribute(i, Kind);
446-
}
447-
448443
/// check if an attributes is in the list of attributes.
449444
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const {
450445
return getAttributes().hasParamAttr(ArgNo, Kind);
@@ -470,17 +465,10 @@ class Function : public GlobalObject, public ilist_node<Function> {
470465
return AttributeSets.getAttribute(i, Kind);
471466
}
472467

473-
/// adds the dereferenceable attribute to the list of attributes.
474-
void addDereferenceableAttr(unsigned i, uint64_t Bytes);
475-
476468
/// adds the dereferenceable attribute to the list of attributes for
477469
/// the given arg.
478470
void addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes);
479471

480-
/// adds the dereferenceable_or_null attribute to the list of
481-
/// attributes.
482-
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
483-
484472
/// adds the dereferenceable_or_null attribute to the list of
485473
/// attributes for the given arg.
486474
void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes);

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,7 @@ void SelectionDAGBuilder::visitSPDescriptorParent(StackProtectorDescriptor &SPD,
26682668
TargetLowering::ArgListEntry Entry;
26692669
Entry.Node = GuardVal;
26702670
Entry.Ty = FnTy->getParamType(0);
2671-
if (GuardCheckFn->hasAttribute(1, Attribute::AttrKind::InReg))
2671+
if (GuardCheckFn->hasParamAttribute(0, Attribute::AttrKind::InReg))
26722672
Entry.IsInReg = true;
26732673
Args.push_back(Entry);
26742674

llvm/lib/IR/Function.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -601,24 +601,12 @@ void Function::removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs) {
601601
setAttributes(PAL);
602602
}
603603

604-
void Function::addDereferenceableAttr(unsigned i, uint64_t Bytes) {
605-
AttributeList PAL = getAttributes();
606-
PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes);
607-
setAttributes(PAL);
608-
}
609-
610604
void Function::addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes) {
611605
AttributeList PAL = getAttributes();
612606
PAL = PAL.addDereferenceableParamAttr(getContext(), ArgNo, Bytes);
613607
setAttributes(PAL);
614608
}
615609

616-
void Function::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) {
617-
AttributeList PAL = getAttributes();
618-
PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes);
619-
setAttributes(PAL);
620-
}
621-
622610
void Function::addDereferenceableOrNullParamAttr(unsigned ArgNo,
623611
uint64_t Bytes) {
624612
AttributeList PAL = getAttributes();

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static bool setDoesNotThrow(Function &F) {
9696
}
9797

9898
static bool setRetDoesNotAlias(Function &F) {
99-
if (F.hasAttribute(AttributeList::ReturnIndex, Attribute::NoAlias))
99+
if (F.hasRetAttribute(Attribute::NoAlias))
100100
return false;
101101
F.addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias);
102102
++NumNoAlias;
@@ -145,7 +145,7 @@ static bool setSignExtendedArg(Function &F, unsigned ArgNo) {
145145

146146
static bool setRetNoUndef(Function &F) {
147147
if (!F.getReturnType()->isVoidTy() &&
148-
!F.hasAttribute(AttributeList::ReturnIndex, Attribute::NoUndef)) {
148+
!F.hasRetAttribute(Attribute::NoUndef)) {
149149
F.addAttribute(AttributeList::ReturnIndex, Attribute::NoUndef);
150150
++NumNoUndef;
151151
return true;

0 commit comments

Comments
 (0)