Skip to content

Commit 142bd19

Browse files
committed
apply comment (do not pass VL0 to setOperand)
1 parent 517c32f commit 142bd19

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,12 +3342,11 @@ class BoUpSLP {
33423342
}
33433343

33443344
/// Set this bundle's operand from Scalars.
3345-
void setOperand(Instruction *VL0, const BoUpSLP &R,
3346-
bool RequireReorder = false) {
3347-
VLOperands Ops(Scalars, VL0, R);
3345+
void setOperand(const BoUpSLP &R, bool RequireReorder = false) {
3346+
VLOperands Ops(Scalars, MainOp, R);
33483347
if (RequireReorder)
33493348
Ops.reorder();
3350-
for (unsigned I : seq<unsigned>(VL0->getNumOperands()))
3349+
for (unsigned I : seq<unsigned>(MainOp->getNumOperands()))
33513350
setOperand(I, Ops.getVL(I));
33523351
}
33533352

@@ -8454,7 +8453,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
84548453
{}, CurrentOrder);
84558454
LLVM_DEBUG(dbgs() << "SLP: added inserts bundle.\n");
84568455

8457-
TE->setOperand(VL0, *this);
8456+
TE->setOperand(*this);
84588457
buildTree_rec(TE->getOperand(1), Depth + 1, {TE, 1});
84598458
return;
84608459
}
@@ -8492,7 +8491,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
84928491
case TreeEntry::NeedToGather:
84938492
llvm_unreachable("Unexpected loads state.");
84948493
}
8495-
TE->setOperand(VL0, *this);
8494+
TE->setOperand(*this);
84968495
if (State == TreeEntry::ScatterVectorize)
84978496
buildTree_rec(PointerOps, Depth + 1, {TE, 0});
84988497
return;
@@ -8532,7 +8531,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
85328531
ReuseShuffleIndices);
85338532
LLVM_DEBUG(dbgs() << "SLP: added a vector of casts.\n");
85348533

8535-
TE->setOperand(VL0, *this);
8534+
TE->setOperand(*this);
85368535
for (unsigned I : seq<unsigned>(VL0->getNumOperands()))
85378536
buildTree_rec(TE->getOperand(I), Depth + 1, {TE, I});
85388537
if (ShuffleOrOp == Instruction::Trunc) {
@@ -8629,8 +8628,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
86298628
ReuseShuffleIndices);
86308629
LLVM_DEBUG(dbgs() << "SLP: added a vector of un/bin op.\n");
86318630

8632-
TE->setOperand(VL0, *this,
8633-
isa<BinaryOperator>(VL0) && isCommutative(VL0));
8631+
TE->setOperand(*this, isa<BinaryOperator>(VL0) && isCommutative(VL0));
86348632
for (unsigned I : seq<unsigned>(VL0->getNumOperands()))
86358633
buildTree_rec(TE->getOperand(I), Depth + 1, {TE, I});
86368634
return;
@@ -8696,7 +8694,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
86968694
fixupOrderingIndices(CurrentOrder);
86978695
TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
86988696
ReuseShuffleIndices, CurrentOrder);
8699-
TE->setOperand(VL0, *this);
8697+
TE->setOperand(*this);
87008698
buildTree_rec(TE->getOperand(0), Depth + 1, {TE, 0});
87018699
if (Consecutive)
87028700
LLVM_DEBUG(dbgs() << "SLP: added a vector of stores.\n");
@@ -8712,7 +8710,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
87128710

87138711
TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
87148712
ReuseShuffleIndices);
8715-
TE->setOperand(VL0, *this, isCommutative(VL0));
8713+
TE->setOperand(*this, isCommutative(VL0));
87168714
for (unsigned I : seq<unsigned>(CI->arg_size())) {
87178715
// For scalar operands no need to create an entry since no need to
87188716
// vectorize it.
@@ -8768,7 +8766,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
87688766
return;
87698767
}
87708768

8771-
TE->setOperand(VL0, *this, isa<BinaryOperator>(VL0) || CI);
8769+
TE->setOperand(*this, isa<BinaryOperator>(VL0) || CI);
87728770
for (unsigned I : seq<unsigned>(VL0->getNumOperands()))
87738771
buildTree_rec(TE->getOperand(I), Depth + 1, {TE, I});
87748772
return;

0 commit comments

Comments
 (0)