@@ -2022,9 +2022,8 @@ class BoUpSLP {
2022
2022
2023
2023
public:
2024
2024
/// 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) {
2028
2027
// Append all the operands of RootVL.
2029
2028
appendOperandsOfVL(RootVL);
2030
2029
}
@@ -2506,10 +2505,10 @@ class BoUpSLP {
2506
2505
2507
2506
/// Reorder commutative or alt operands to get better probability of
2508
2507
/// 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);
2513
2512
2514
2513
/// Helper for `findExternalStoreUsersReorderIndices()`. It iterates over the
2515
2514
/// 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,
6626
6625
// so that each side is more likely to have the same opcode.
6627
6626
assert(P0 == CmpInst::getSwappedPredicate(P0) &&
6628
6627
"Commutative Predicate mismatch");
6629
- reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE, * this);
6628
+ reorderInputsAccordingToOpcode(VL, Left, Right, *this);
6630
6629
} else {
6631
6630
// Collect operands - commute if it uses the swapped predicate.
6632
6631
for (Value *V : VL) {
@@ -6673,7 +6672,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
6673
6672
// have the same opcode.
6674
6673
if (isa<BinaryOperator>(VL0) && VL0->isCommutative()) {
6675
6674
ValueList Left, Right;
6676
- reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE, * this);
6675
+ reorderInputsAccordingToOpcode(VL, Left, Right, *this);
6677
6676
TE->setOperand(0, Left);
6678
6677
TE->setOperand(1, Right);
6679
6678
buildTree_rec(Left, Depth + 1, {TE, 0});
@@ -6810,8 +6809,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
6810
6809
if (!CI || all_of(VL, [](Value *V) {
6811
6810
return cast<CmpInst>(V)->isCommutative();
6812
6811
})) {
6813
- reorderInputsAccordingToOpcode(VL, Left, Right, *TLI, *DL, *SE,
6814
- *this);
6812
+ reorderInputsAccordingToOpcode(VL, Left, Right, *this);
6815
6813
} else {
6816
6814
auto *MainCI = cast<CmpInst>(S.MainOp);
6817
6815
auto *AltCI = cast<CmpInst>(S.AltOp);
@@ -10520,13 +10518,13 @@ InstructionCost BoUpSLP::getGatherCost(ArrayRef<Value *> VL,
10520
10518
10521
10519
// Perform operand reordering on the instructions in VL and return the reordered
10522
10520
// 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) {
10527
10525
if (VL.empty())
10528
10526
return;
10529
- VLOperands Ops(VL, TLI, DL, SE, R);
10527
+ VLOperands Ops(VL, R);
10530
10528
// Reorder the operands in place.
10531
10529
Ops.reorder();
10532
10530
Left = Ops.getVL(0);
0 commit comments