Skip to content

Commit 83627c4

Browse files
committed
address comments
Created using spr 1.3.5
1 parent 5344a46 commit 83627c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,9 @@ class BoUpSLP {
28752875
for (OperandDataVec &Ops : OpsVec)
28762876
Ops.resize(NumLanes);
28772877
for (unsigned Lane : seq<unsigned>(NumLanes)) {
2878+
Value *V = VL[Lane];
2879+
assert((isa<Instruction>(V) || isa<PoisonValue>(V)) &&
2880+
"Expected instruction or poison value");
28782881
// Our tree has just 3 nodes: the root and two operands.
28792882
// It is therefore trivial to get the APO. We only need to check the
28802883
// opcode of V and whether the operand at OpIdx is the LHS or RHS
@@ -2885,14 +2888,12 @@ class BoUpSLP {
28852888
// Since operand reordering is performed on groups of commutative
28862889
// operations or alternating sequences (e.g., +, -), we can safely tell
28872890
// the inverse operations by checking commutativity.
2888-
auto *I = dyn_cast<Instruction>(VL[Lane]);
2889-
if (!I && isa<PoisonValue>(VL[Lane])) {
2891+
if (isa<PoisonValue>(V)) {
28902892
for (unsigned OpIdx : seq<unsigned>(NumOperands))
28912893
OpsVec[OpIdx][Lane] = {Operands[OpIdx][Lane], true, false};
28922894
continue;
28932895
}
2894-
assert(I && "Expected instruction");
2895-
auto [SelectedOp, Ops] = convertTo(I, S);
2896+
auto [SelectedOp, Ops] = convertTo(cast<Instruction>(V), S);
28962897
bool IsInverseOperation = !isCommutative(SelectedOp);
28972898
for (unsigned OpIdx : seq<unsigned>(ArgSize)) {
28982899
bool APO = (OpIdx == 0) ? false : IsInverseOperation;

0 commit comments

Comments
 (0)