[VPlan] Print VPValue operands for VPWidenPHI if possible.

For VPWidenPHIRecipes that model all incoming values as VPValue
operands, print those operands instead of printing the original PHI.

D99294 updates recipes of reduction PHIs to use the VPValue for the
incoming value from the loop backedge, making use of this new printing.
This commit is contained in:
Florian Hahn 2021-04-06 11:54:23 +01:00
parent 3eadcb86ab
commit a6b06b785c
2 changed files with 16 additions and 2 deletions

View File

@ -1008,7 +1008,21 @@ void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent, void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const { VPSlotTracker &SlotTracker) const {
O << Indent << "WIDEN-PHI " << VPlanIngredient(getUnderlyingValue()); O << Indent << "WIDEN-PHI ";
auto *OriginalPhi = cast<PHINode>(getUnderlyingValue());
// Unless all incoming values are modeled in VPlan print the original PHI
// directly.
// TODO: Remove once all VPWidenPHIRecipe instances keep all relevant incoming
// values as VPValues.
if (getNumOperands() != OriginalPhi->getNumOperands()) {
O << VPlanIngredient(OriginalPhi);
return;
}
printAsOperand(O, SlotTracker);
O << " = phi ";
printOperands(O, SlotTracker);
} }
void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent, void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent,

View File

@ -111,7 +111,7 @@ compound=true
N1 -> N2 [ label=""] N1 -> N2 [ label=""]
N2 [label = N2 [label =
"for.body:\l" + "for.body:\l" +
" WIDEN-PHI %indvars.iv = phi 0, %indvars.iv.next\l" + " WIDEN-PHI ir\<%indvars.iv\> = phi ir\<0\>, ir\<%indvars.iv.next\>\l" +
" EMIT ir\<%arr.idx\> = getelementptr ir\<%A\> ir\<%indvars.iv\>\l" + " EMIT ir\<%arr.idx\> = getelementptr ir\<%A\> ir\<%indvars.iv\>\l" +
" EMIT ir\<%l1\> = load ir\<%arr.idx\>\l" + " EMIT ir\<%l1\> = load ir\<%arr.idx\>\l" +
" EMIT ir\<%res\> = add ir\<%l1\> ir\<10\>\l" + " EMIT ir\<%res\> = add ir\<%l1\> ir\<10\>\l" +