@@ -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