[llvm] 9536bbe - Attributor: Don't pass ArrayRef by const reference
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 31 05:43:17 PDT 2023
Author: Matt Arsenault
Date: 2023-08-31T08:41:08-04:00
New Revision: 9536bbe464c8b53b75c485b2da607326dcd41929
URL: https://github.com/llvm/llvm-project/commit/9536bbe464c8b53b75c485b2da607326dcd41929
DIFF: https://github.com/llvm/llvm-project/commit/9536bbe464c8b53b75c485b2da607326dcd41929.diff
LOG: Attributor: Don't pass ArrayRef by const reference
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 1a2dcf6ab18612..af28cbfd1f3316 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1917,13 +1917,13 @@ struct Attributor {
/// Remove all \p AttrKinds attached to \p IRP.
ChangeStatus removeAttrs(const IRPosition &IRP,
- const ArrayRef<Attribute::AttrKind> &AttrKinds);
+ ArrayRef<Attribute::AttrKind> AttrKinds);
ChangeStatus removeAttrs(const IRPosition &IRP, ArrayRef<StringRef> Attrs);
/// Attach \p DeducedAttrs to \p IRP, if \p ForceReplace is set we do this
/// even if the same attribute kind was already present.
ChangeStatus manifestAttrs(const IRPosition &IRP,
- const ArrayRef<Attribute> &DeducedAttrs,
+ ArrayRef<Attribute> DeducedAttrs,
bool ForceReplace = false);
private:
@@ -1934,8 +1934,7 @@ struct Attributor {
/// Helper to apply \p CB on all attributes of type \p AttrDescs of \p IRP.
template <typename DescTy>
- ChangeStatus updateAttrMap(const IRPosition &IRP,
- const ArrayRef<DescTy> &AttrDescs,
+ ChangeStatus updateAttrMap(const IRPosition &IRP, ArrayRef<DescTy> AttrDescs,
function_ref<bool(const DescTy &, AttributeSet,
AttributeMask &, AttrBuilder &)>
CB);
@@ -2324,7 +2323,7 @@ struct Attributor {
bool checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
const Function *Fn,
const AbstractAttribute *QueryingAA,
- const ArrayRef<unsigned> &Opcodes,
+ ArrayRef<unsigned> Opcodes,
bool &UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false);
@@ -2335,7 +2334,7 @@ struct Attributor {
/// present in \p Opcode and return true if \p Pred holds on all of them.
bool checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
const AbstractAttribute &QueryingAA,
- const ArrayRef<unsigned> &Opcodes,
+ ArrayRef<unsigned> Opcodes,
bool &UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false);
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 9cf381cf8b31b1..86a9f22ea32e2f 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1108,8 +1108,7 @@ bool Attributor::getAttrsFromAssumes(const IRPosition &IRP,
template <typename DescTy>
ChangeStatus
-Attributor::updateAttrMap(const IRPosition &IRP,
- const ArrayRef<DescTy> &AttrDescs,
+Attributor::updateAttrMap(const IRPosition &IRP, ArrayRef<DescTy> AttrDescs,
function_ref<bool(const DescTy &, AttributeSet,
AttributeMask &, AttrBuilder &)>
CB) {
@@ -1216,9 +1215,8 @@ void Attributor::getAttrs(const IRPosition &IRP,
getAttrsFromAssumes(IRP, AK, Attrs);
}
-ChangeStatus
-Attributor::removeAttrs(const IRPosition &IRP,
- const ArrayRef<Attribute::AttrKind> &AttrKinds) {
+ChangeStatus Attributor::removeAttrs(const IRPosition &IRP,
+ ArrayRef<Attribute::AttrKind> AttrKinds) {
auto RemoveAttrCB = [&](const Attribute::AttrKind &Kind, AttributeSet AttrSet,
AttributeMask &AM, AttrBuilder &) {
if (!AttrSet.hasAttribute(Kind))
@@ -1243,7 +1241,7 @@ ChangeStatus Attributor::removeAttrs(const IRPosition &IRP,
}
ChangeStatus Attributor::manifestAttrs(const IRPosition &IRP,
- const ArrayRef<Attribute> &Attrs,
+ ArrayRef<Attribute> Attrs,
bool ForceReplace) {
LLVMContext &Ctx = IRP.getAnchorValue().getContext();
auto AddAttrCB = [&](const Attribute &Attr, AttributeSet AttrSet,
@@ -2006,7 +2004,7 @@ bool Attributor::checkForAllReturnedValues(function_ref<bool(Value &)> Pred,
static bool checkForAllInstructionsImpl(
Attributor *A, InformationCache::OpcodeInstMapTy &OpcodeInstMap,
function_ref<bool(Instruction &)> Pred, const AbstractAttribute *QueryingAA,
- const AAIsDead *LivenessAA, const ArrayRef<unsigned> &Opcodes,
+ const AAIsDead *LivenessAA, ArrayRef<unsigned> Opcodes,
bool &UsedAssumedInformation, bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false) {
for (unsigned Opcode : Opcodes) {
@@ -2036,7 +2034,7 @@ static bool checkForAllInstructionsImpl(
bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
const Function *Fn,
const AbstractAttribute *QueryingAA,
- const ArrayRef<unsigned> &Opcodes,
+ ArrayRef<unsigned> Opcodes,
bool &UsedAssumedInformation,
bool CheckBBLivenessOnly,
bool CheckPotentiallyDead) {
@@ -2061,7 +2059,7 @@ bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
bool Attributor::checkForAllInstructions(function_ref<bool(Instruction &)> Pred,
const AbstractAttribute &QueryingAA,
- const ArrayRef<unsigned> &Opcodes,
+ ArrayRef<unsigned> Opcodes,
bool &UsedAssumedInformation,
bool CheckBBLivenessOnly,
bool CheckPotentiallyDead) {
More information about the llvm-commits
mailing list