Skip to content

Commit 31b8ba5

Browse files
[Analysis, CodeGen] Use ArrayRef instead of const ArrayRef (NFC) (llvm#166026)
This patch improves readability by using "ArrayRef<T>" instead of "const ArrayRef<T>" and "const ArrayRef<T> &" in function parameter types.
1 parent b82bde6 commit 31b8ba5

File tree

15 files changed

+25
-26
lines changed

15 files changed

+25
-26
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ class TargetTransformInfo {
17641764
/// \param Types List of types to check.
17651765
LLVM_ABI bool areTypesABICompatible(const Function *Caller,
17661766
const Function *Callee,
1767-
const ArrayRef<Type *> &Types) const;
1767+
ArrayRef<Type *> Types) const;
17681768

17691769
/// The type of load/store indexing.
17701770
enum MemIndexedMode {

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ class TargetTransformInfoImplBase {
10281028

10291029
virtual bool areTypesABICompatible(const Function *Caller,
10301030
const Function *Callee,
1031-
const ArrayRef<Type *> &Types) const {
1031+
ArrayRef<Type *> Types) const {
10321032
return (Caller->getFnAttribute("target-cpu") ==
10331033
Callee->getFnAttribute("target-cpu")) &&
10341034
(Caller->getFnAttribute("target-features") ==

llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class CombinerHelper {
293293
SmallVectorImpl<Register> &Ops) const;
294294
/// Replace \p MI with a concat_vectors with \p Ops.
295295
void applyCombineShuffleVector(MachineInstr &MI,
296-
const ArrayRef<Register> Ops) const;
296+
ArrayRef<Register> Ops) const;
297297

298298
/// Optimize memcpy intrinsics et al, e.g. constant len calls.
299299
/// /p MaxLen if non-zero specifies the max length of a mem libcall to inline.

llvm/include/llvm/CodeGen/SDPatternMatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ template <typename... PatternTs> struct ReassociatableOpc_match {
13111311
}
13121312

13131313
[[nodiscard]] inline bool
1314-
reassociatableMatchHelper(const ArrayRef<SmallBitVector> Matches,
1314+
reassociatableMatchHelper(ArrayRef<SmallBitVector> Matches,
13151315
SmallBitVector &Used, size_t Curr = 0) {
13161316
if (Curr == Matches.size())
13171317
return true;

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,10 +2424,10 @@ ScalarEvolution::getStrengthenedNoWrapFlagsFromBinOp(
24242424
// We're trying to construct a SCEV of type `Type' with `Ops' as operands and
24252425
// `OldFlags' as can't-wrap behavior. Infer a more aggressive set of
24262426
// can't-overflow flags for the operation if possible.
2427-
static SCEV::NoWrapFlags
2428-
StrengthenNoWrapFlags(ScalarEvolution *SE, SCEVTypes Type,
2429-
const ArrayRef<const SCEV *> Ops,
2430-
SCEV::NoWrapFlags Flags) {
2427+
static SCEV::NoWrapFlags StrengthenNoWrapFlags(ScalarEvolution *SE,
2428+
SCEVTypes Type,
2429+
ArrayRef<const SCEV *> Ops,
2430+
SCEV::NoWrapFlags Flags) {
24312431
using namespace std::placeholders;
24322432

24332433
using OBO = OverflowingBinaryOperator;
@@ -2540,7 +2540,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
25402540
unsigned Idx = isa<SCEVConstant>(Ops[0]) ? 1 : 0;
25412541

25422542
// Delay expensive flag strengthening until necessary.
2543-
auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) {
2543+
auto ComputeFlags = [this, OrigFlags](ArrayRef<const SCEV *> Ops) {
25442544
return StrengthenNoWrapFlags(this, scAddExpr, Ops, OrigFlags);
25452545
};
25462546

@@ -3125,7 +3125,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
31253125
return Folded;
31263126

31273127
// Delay expensive flag strengthening until necessary.
3128-
auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) {
3128+
auto ComputeFlags = [this, OrigFlags](ArrayRef<const SCEV *> Ops) {
31293129
return StrengthenNoWrapFlags(this, scMulExpr, Ops, OrigFlags);
31303130
};
31313131

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,9 @@ TargetTransformInfo::getInlineCallPenalty(const Function *F,
13531353
return TTIImpl->getInlineCallPenalty(F, Call, DefaultCallPenalty);
13541354
}
13551355

1356-
bool TargetTransformInfo::areTypesABICompatible(
1357-
const Function *Caller, const Function *Callee,
1358-
const ArrayRef<Type *> &Types) const {
1356+
bool TargetTransformInfo::areTypesABICompatible(const Function *Caller,
1357+
const Function *Callee,
1358+
ArrayRef<Type *> Types) const {
13591359
return TTIImpl->areTypesABICompatible(Caller, Callee, Types);
13601360
}
13611361

llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ void DbgValueHistoryMap::Entry::endEntry(EntryIndex Index) {
112112
/// to the first intersecting scope range if one exists.
113113
static std::optional<ArrayRef<InsnRange>::iterator>
114114
intersects(const MachineInstr *StartMI, const MachineInstr *EndMI,
115-
const ArrayRef<InsnRange> &Ranges,
116-
const InstructionOrdering &Ordering) {
115+
ArrayRef<InsnRange> Ranges, const InstructionOrdering &Ordering) {
117116
for (auto RangesI = Ranges.begin(), RangesE = Ranges.end();
118117
RangesI != RangesE; ++RangesI) {
119118
if (EndMI && Ordering.isBefore(EndMI, RangesI->first))

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ bool CombinerHelper::matchCombineShuffleVector(
589589
return true;
590590
}
591591

592-
void CombinerHelper::applyCombineShuffleVector(
593-
MachineInstr &MI, const ArrayRef<Register> Ops) const {
592+
void CombinerHelper::applyCombineShuffleVector(MachineInstr &MI,
593+
ArrayRef<Register> Ops) const {
594594
Register DstReg = MI.getOperand(0).getReg();
595595
Builder.setInsertPt(*MI.getParent(), MI);
596596
Register NewDstReg = MRI.cloneVirtualRegister(DstReg);

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9374,7 +9374,7 @@ static unsigned bigEndianByteAt(unsigned BW, unsigned i) {
93749374
// Check if the bytes offsets we are looking at match with either big or
93759375
// little endian value loaded. Return true for big endian, false for little
93769376
// endian, and std::nullopt if match failed.
9377-
static std::optional<bool> isBigEndian(const ArrayRef<int64_t> ByteOffsets,
9377+
static std::optional<bool> isBigEndian(ArrayRef<int64_t> ByteOffsets,
93789378
int64_t FirstOffset) {
93799379
// The endian can be decided only when it is 2 bytes at least.
93809380
unsigned Width = ByteOffsets.size();

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
308308
return (EffectiveCallerBits & EffectiveCalleeBits) == EffectiveCalleeBits;
309309
}
310310

311-
bool AArch64TTIImpl::areTypesABICompatible(
312-
const Function *Caller, const Function *Callee,
313-
const ArrayRef<Type *> &Types) const {
311+
bool AArch64TTIImpl::areTypesABICompatible(const Function *Caller,
312+
const Function *Callee,
313+
ArrayRef<Type *> Types) const {
314314
if (!BaseT::areTypesABICompatible(Caller, Callee, Types))
315315
return false;
316316

0 commit comments

Comments
 (0)