@@ -1028,16 +1028,19 @@ static const VPBasicBlock *getIncomingBlockForRecipe(const VPRecipeBase *R,
1028
1028
return Pred->getExitingBasicBlock ();
1029
1029
}
1030
1030
1031
+ template <>
1032
+ const VPBasicBlock *
1033
+ VPPhiAccessors<VPIRPhi>::getIncomingBlock(unsigned Idx) const {
1034
+ return getIncomingBlockForRecipe (getAsRecipe (), Idx);
1035
+ }
1036
+
1031
1037
void VPIRPhi::execute (VPTransformState &State) {
1032
1038
PHINode *Phi = &getIRPhi ();
1033
- for (const auto &[Idx, Op] : enumerate(operands ())) {
1034
- VPValue *ExitValue = Op;
1039
+ for (const auto &[ExitValue, IncVPBB] : incoming_values_and_blocks ()) {
1035
1040
auto Lane = vputils::isUniformAfterVectorization (ExitValue)
1036
1041
? VPLane::getFirstLane ()
1037
1042
: VPLane::getLastLaneForVF (State.VF );
1038
- VPBlockBase *Pred = getParent ()->getPredecessors ()[Idx];
1039
- auto *PredVPBB = Pred->getExitingBasicBlock ();
1040
- BasicBlock *PredBB = State.CFG .VPBB2IRBB [PredVPBB];
1043
+ BasicBlock *PredBB = State.CFG .VPBB2IRBB [IncVPBB];
1041
1044
// Set insertion point in PredBB in case an extract needs to be generated.
1042
1045
// TODO: Model extracts explicitly.
1043
1046
State.Builder .SetInsertPoint (PredBB, PredBB->getFirstNonPHIIt ());
@@ -1062,12 +1065,11 @@ void VPIRPhi::print(raw_ostream &O, const Twine &Indent,
1062
1065
1063
1066
if (getNumOperands () != 0 ) {
1064
1067
O << " (extra operand" << (getNumOperands () > 1 ? " s" : " " ) << " : " ;
1065
- interleaveComma (
1066
- enumerate(operands ()), O, [this , &O, &SlotTracker](auto Op) {
1067
- Op.value ()->printAsOperand (O, SlotTracker);
1068
- O << " from " ;
1069
- getParent ()->getPredecessors ()[Op.index ()]->printAsOperand (O);
1070
- });
1068
+ interleaveComma (incoming_values_and_blocks (), O, [&O, &SlotTracker](auto Op) {
1069
+ std::get<0 >(Op)->printAsOperand (O, SlotTracker);
1070
+ O << " from " ;
1071
+ std::get<1 >(Op)->printAsOperand (O);
1072
+ });
1071
1073
O << " )" ;
1072
1074
}
1073
1075
}
0 commit comments