@@ -857,12 +857,13 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
857857void VPIRInstruction::execute (VPTransformState &State) {
858858 assert ((isa<PHINode>(&I) || getNumOperands () == 0 ) &&
859859 " Only PHINodes can have extra operands" );
860- if ( getNumOperands () == 1 ) {
861- VPValue *ExitValue = getOperand ( 0 ) ;
860+ for ( const auto &[Idx, Op] : enumerate( operands ()) ) {
861+ VPValue *ExitValue = Op ;
862862 auto Lane = vputils::isUniformAfterVectorization (ExitValue)
863863 ? VPLane::getFirstLane ()
864864 : VPLane::getLastLaneForVF (State.VF );
865- auto *PredVPBB = cast<VPBasicBlock>(getParent ()->getSinglePredecessor ());
865+ VPBlockBase *Pred = getParent ()->getPredecessors ()[Idx];
866+ auto *PredVPBB = Pred->getExitingBasicBlock ();
866867 BasicBlock *PredBB = State.CFG .VPBB2IRBB [PredVPBB];
867868 // Set insertion point in PredBB in case an extract needs to be generated.
868869 // TODO: Model extracts explicitly.
@@ -890,7 +891,7 @@ void VPIRInstruction::print(raw_ostream &O, const Twine &Indent,
890891 O << Indent << " IR " << I;
891892
892893 if (getNumOperands () != 0 ) {
893- assert (getNumOperands () == 1 && " can have at most 1 operand" );
894+ // assert(getNumOperands() == 1 && "can have at most 1 operand");
894895 O << " (extra operand: " ;
895896 printOperands (O, SlotTracker);
896897 O << " )" ;
0 commit comments