@@ -843,12 +843,13 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
843843void VPIRInstruction::execute (VPTransformState &State) {
844844 assert ((isa<PHINode>(&I) || getNumOperands () == 0 ) &&
845845 " Only PHINodes can have extra operands" );
846- if ( getNumOperands () == 1 ) {
847- VPValue *ExitValue = getOperand ( 0 ) ;
846+ for ( const auto &[Idx, Op] : enumerate( operands ()) ) {
847+ VPValue *ExitValue = Op ;
848848 auto Lane = vputils::isUniformAfterVectorization (ExitValue)
849849 ? VPLane::getFirstLane ()
850850 : VPLane::getLastLaneForVF (State.VF );
851- auto *PredVPBB = cast<VPBasicBlock>(getParent ()->getSinglePredecessor ());
851+ VPBlockBase *Pred = getParent ()->getPredecessors ()[Idx];
852+ auto *PredVPBB = Pred->getExitingBasicBlock ();
852853 BasicBlock *PredBB = State.CFG .VPBB2IRBB [PredVPBB];
853854 // Set insertion point in PredBB in case an extract needs to be generated.
854855 // TODO: Model extracts explicitly.
@@ -869,7 +870,7 @@ void VPIRInstruction::print(raw_ostream &O, const Twine &Indent,
869870 O << Indent << " IR " << I;
870871
871872 if (getNumOperands () != 0 ) {
872- assert (getNumOperands () == 1 && " can have at most 1 operand" );
873+ // assert(getNumOperands() == 1 && "can have at most 1 operand");
873874 O << " (extra operand: " ;
874875 printOperands (O, SlotTracker);
875876 O << " )" ;
0 commit comments