Skip to content

Commit 9536bbe

Browse files
committed
Attributor: Don't pass ArrayRef by const reference
1 parent 850ec7b commit 9536bbe

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,13 +1917,13 @@ struct Attributor {
19171917

19181918
/// Remove all \p AttrKinds attached to \p IRP.
19191919
ChangeStatus removeAttrs(const IRPosition &IRP,
1920-
const ArrayRef<Attribute::AttrKind> &AttrKinds);
1920+
ArrayRef<Attribute::AttrKind> AttrKinds);
19211921
ChangeStatus removeAttrs(const IRPosition &IRP, ArrayRef<StringRef> Attrs);
19221922

19231923
/// Attach \p DeducedAttrs to \p IRP, if \p ForceReplace is set we do this
19241924
/// even if the same attribute kind was already present.
19251925
ChangeStatus manifestAttrs(const IRPosition &IRP,
1926-
const ArrayRef<Attribute> &DeducedAttrs,
1926+
ArrayRef<Attribute> DeducedAttrs,
19271927
bool ForceReplace = false);
19281928

19291929
private:
@@ -1934,8 +1934,7 @@ struct Attributor {
19341934

19351935
/// Helper to apply \p CB on all attributes of type \p AttrDescs of \p IRP.
19361936
template <typename DescTy>
1937-
ChangeStatus updateAttrMap(const IRPosition &IRP,
1938-
const ArrayRef<DescTy> &AttrDescs,
1937+
ChangeStatus updateAttrMap(const IRPosition &IRP, ArrayRef<DescTy> AttrDescs,
19391938
function_ref<bool(const DescTy &, AttributeSet,
19401939
AttributeMask &, AttrBuilder &)>
19411940
CB);
@@ -2324,7 +2323,7 @@ struct Attributor {
23242323
bool checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
23252324
const Function *Fn,
23262325
const AbstractAttribute *QueryingAA,
2327-
const ArrayRef<unsigned> &Opcodes,
2326+
ArrayRef<unsigned> Opcodes,
23282327
bool &UsedAssumedInformation,
23292328
bool CheckBBLivenessOnly = false,
23302329
bool CheckPotentiallyDead = false);
@@ -2335,7 +2334,7 @@ struct Attributor {
23352334
/// present in \p Opcode and return true if \p Pred holds on all of them.
23362335
bool checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
23372336
const AbstractAttribute &QueryingAA,
2338-
const ArrayRef<unsigned> &Opcodes,
2337+
ArrayRef<unsigned> Opcodes,
23392338
bool &UsedAssumedInformation,
23402339
bool CheckBBLivenessOnly = false,
23412340
bool CheckPotentiallyDead = false);

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,7 @@ bool Attributor::getAttrsFromAssumes(const IRPosition &IRP,
11081108

11091109
template <typename DescTy>
11101110
ChangeStatus
1111-
Attributor::updateAttrMap(const IRPosition &IRP,
1112-
const ArrayRef<DescTy> &AttrDescs,
1111+
Attributor::updateAttrMap(const IRPosition &IRP, ArrayRef<DescTy> AttrDescs,
11131112
function_ref<bool(const DescTy &, AttributeSet,
11141113
AttributeMask &, AttrBuilder &)>
11151114
CB) {
@@ -1216,9 +1215,8 @@ void Attributor::getAttrs(const IRPosition &IRP,
12161215
getAttrsFromAssumes(IRP, AK, Attrs);
12171216
}
12181217

1219-
ChangeStatus
1220-
Attributor::removeAttrs(const IRPosition &IRP,
1221-
const ArrayRef<Attribute::AttrKind> &AttrKinds) {
1218+
ChangeStatus Attributor::removeAttrs(const IRPosition &IRP,
1219+
ArrayRef<Attribute::AttrKind> AttrKinds) {
12221220
auto RemoveAttrCB = [&](const Attribute::AttrKind &Kind, AttributeSet AttrSet,
12231221
AttributeMask &AM, AttrBuilder &) {
12241222
if (!AttrSet.hasAttribute(Kind))
@@ -1243,7 +1241,7 @@ ChangeStatus Attributor::removeAttrs(const IRPosition &IRP,
12431241
}
12441242

12451243
ChangeStatus Attributor::manifestAttrs(const IRPosition &IRP,
1246-
const ArrayRef<Attribute> &Attrs,
1244+
ArrayRef<Attribute> Attrs,
12471245
bool ForceReplace) {
12481246
LLVMContext &Ctx = IRP.getAnchorValue().getContext();
12491247
auto AddAttrCB = [&](const Attribute &Attr, AttributeSet AttrSet,
@@ -2006,7 +2004,7 @@ bool Attributor::checkForAllReturnedValues(function_ref<bool(Value &)> Pred,
20062004
static bool checkForAllInstructionsImpl(
20072005
Attributor *A, InformationCache::OpcodeInstMapTy &OpcodeInstMap,
20082006
function_ref<bool(Instruction &)> Pred, const AbstractAttribute *QueryingAA,
2009-
const AAIsDead *LivenessAA, const ArrayRef<unsigned> &Opcodes,
2007+
const AAIsDead *LivenessAA, ArrayRef<unsigned> Opcodes,
20102008
bool &UsedAssumedInformation, bool CheckBBLivenessOnly = false,
20112009
bool CheckPotentiallyDead = false) {
20122010
for (unsigned Opcode : Opcodes) {
@@ -2036,7 +2034,7 @@ static bool checkForAllInstructionsImpl(
20362034
bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
20372035
const Function *Fn,
20382036
const AbstractAttribute *QueryingAA,
2039-
const ArrayRef<unsigned> &Opcodes,
2037+
ArrayRef<unsigned> Opcodes,
20402038
bool &UsedAssumedInformation,
20412039
bool CheckBBLivenessOnly,
20422040
bool CheckPotentiallyDead) {
@@ -2061,7 +2059,7 @@ bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
20612059

20622060
bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
20632061
const AbstractAttribute &QueryingAA,
2064-
const ArrayRef<unsigned> &Opcodes,
2062+
ArrayRef<unsigned> Opcodes,
20652063
bool &UsedAssumedInformation,
20662064
bool CheckBBLivenessOnly,
20672065
bool CheckPotentiallyDead) {

0 commit comments

Comments
 (0)