@@ -413,20 +413,20 @@ VPInstruction::VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
413413 Opcode(Opcode), Name(Name.str()) {
414414 assert (flagsValidForOpcode (getOpcode ()) &&
415415 " Set flags not supported for the provided opcode" );
416- assert ((getNumOperandsForOpcode () == -1u ||
417- getNumOperandsForOpcode () == getNumOperands ()) &&
416+ assert ((getNumOperandsForOpcode (Opcode ) == -1u ||
417+ getNumOperandsForOpcode (Opcode ) == getNumOperands ()) &&
418418 " number of operands does not match opcode" );
419419}
420420
421421#ifndef NDEBUG
422- unsigned VPInstruction::getNumOperandsForOpcode () const {
423- if (Instruction::isUnaryOp (getOpcode ()) || Instruction::isCast (getOpcode () ))
422+ unsigned VPInstruction::getNumOperandsForOpcode (unsigned Opcode) {
423+ if (Instruction::isUnaryOp (Opcode) || Instruction::isCast (Opcode ))
424424 return 1 ;
425425
426- if (Instruction::isBinaryOp (getOpcode () ))
426+ if (Instruction::isBinaryOp (Opcode ))
427427 return 2 ;
428428
429- switch (getOpcode () ) {
429+ switch (Opcode ) {
430430 case VPInstruction::StepVector:
431431 return 0 ;
432432 case Instruction::Alloca:
@@ -452,15 +452,16 @@ unsigned VPInstruction::getNumOperandsForOpcode() const {
452452 case VPInstruction::ComputeReductionResult:
453453 case VPInstruction::FirstOrderRecurrenceSplice:
454454 case VPInstruction::LogicalAnd:
455- case VPInstruction::WideIVStep:
456455 case VPInstruction::PtrAdd:
456+ case VPInstruction::WideIVStep:
457457 return 2 ;
458458 case Instruction::Select:
459+ case VPInstruction::ComputeAnyOfResult:
459460 case VPInstruction::ComputeFindLastIVResult:
460461 return 3 ;
461462 case Instruction::Call:
462- case Instruction::PHI:
463463 case Instruction::GetElementPtr:
464+ case Instruction::PHI:
464465 case Instruction::Switch:
465466 // Cannot determine the number of operands from the opcode.
466467 return -1u ;
@@ -2772,10 +2773,7 @@ static void scalarizeInstruction(const Instruction *Instr,
27722773
27732774 // Replace the operands of the cloned instructions with their scalar
27742775 // equivalents in the new loop.
2775- auto OpRange = RepRecipe->operands ();
2776- if (isa<CallBase>(Cloned))
2777- OpRange = drop_end (OpRange);
2778- for (const auto &I : enumerate(OpRange)) {
2776+ for (const auto &I : enumerate(RepRecipe->operands ())) {
27792777 auto InputLane = Lane;
27802778 VPValue *Operand = I.value ();
27812779 if (vputils::isSingleScalar (Operand))
0 commit comments