Skip to content

Commit 70cf2a0

Browse files
committed
[SLP][NFC]Simplify function/constructors by removing unnecessary params.
1 parent 688d71e commit 70cf2a0

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,9 +2022,8 @@ class BoUpSLP {
20222022

20232023
public:
20242024
/// Initialize with all the operands of the instruction vector \p RootVL.
2025-
VLOperands(ArrayRef<Value *> RootVL, const TargetLibraryInfo &TLI,
2026-
const DataLayout &DL, ScalarEvolution &SE, const BoUpSLP &R)
2027-
: TLI(TLI), DL(DL), SE(SE), R(R) {
2025+
VLOperands(ArrayRef<Value *> RootVL, const BoUpSLP &R)
2026+
: TLI(*R.TLI), DL(*R.DL), SE(*R.SE), R(R) {
20282027
// Append all the operands of RootVL.
20292028
appendOperandsOfVL(RootVL);
20302029
}
@@ -2506,10 +2505,10 @@ class BoUpSLP {
25062505

25072506
/// Reorder commutative or alt operands to get better probability of
25082507
/// generating vectorized code.
2509-
static void reorderInputsAccordingToOpcode(
2510-
ArrayRef<Value *> VL, SmallVectorImpl<Value *> &Left,
2511-
SmallVectorImpl<Value *> &Right, const TargetLibraryInfo &TLI,
2512-
const DataLayout &DL, ScalarEvolution &SE, const BoUpSLP &R);
2508+
static void reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
2509+
SmallVectorImpl<Value *> &Left,
2510+
SmallVectorImpl<Value *> &Right,
2511+
const BoUpSLP &R);
25132512

25142513
/// Helper for `findExternalStoreUsersReorderIndices()`. It iterates over the
25152514
/// users of \p TE and collects the stores. It returns the map from the store
@@ -6626,7 +6625,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
66266625
// so that each side is more likely to have the same opcode.
66276626
assert(P0 == CmpInst::getSwappedPredicate(P0) &&
66286627
"Commutative Predicate mismatch");
6629-
reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE, *this);
6628+
reorderInputsAccordingToOpcode(VL, Left, Right, *this);
66306629
} else {
66316630
// Collect operands - commute if it uses the swapped predicate.
66326631
for (Value *V : VL) {
@@ -6673,7 +6672,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
66736672
// have the same opcode.
66746673
if (isa<BinaryOperator>(VL0) && VL0->isCommutative()) {
66756674
ValueList Left, Right;
6676-
reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE, *this);
6675+
reorderInputsAccordingToOpcode(VL, Left, Right, *this);
66776676
TE->setOperand(0, Left);
66786677
TE->setOperand(1, Right);
66796678
buildTree_rec(Left, Depth + 1, {TE, 0});
@@ -6810,8 +6809,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
68106809
if (!CI || all_of(VL, [](Value *V) {
68116810
return cast<CmpInst>(V)->isCommutative();
68126811
})) {
6813-
reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE,
6814-
*this);
6812+
reorderInputsAccordingToOpcode(VL, Left, Right, *this);
68156813
} else {
68166814
auto *MainCI = cast<CmpInst>(S.MainOp);
68176815
auto *AltCI = cast<CmpInst>(S.AltOp);
@@ -10520,13 +10518,13 @@ InstructionCost BoUpSLP::getGatherCost(ArrayRef<Value *> VL,
1052010518

1052110519
// Perform operand reordering on the instructions in VL and return the reordered
1052210520
// operands in Left and Right.
10523-
void BoUpSLP::reorderInputsAccordingToOpcode(
10524-
ArrayRef<Value *> VL, SmallVectorImpl<Value *> &Left,
10525-
SmallVectorImpl<Value *> &Right, const TargetLibraryInfo &TLI,
10526-
const DataLayout &DL, ScalarEvolution &SE, const BoUpSLP &R) {
10521+
void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
10522+
SmallVectorImpl<Value *> &Left,
10523+
SmallVectorImpl<Value *> &Right,
10524+
const BoUpSLP &R) {
1052710525
if (VL.empty())
1052810526
return;
10529-
VLOperands Ops(VL, TLI, DL, SE, R);
10527+
VLOperands Ops(VL, R);
1053010528
// Reorder the operands in place.
1053110529
Ops.reorder();
1053210530
Left = Ops.getVL(0);

0 commit comments

Comments
 (0)