[llvm] b24afec - [NFCI][VPlan] Modify Recipes' print methods to honor Indent parameter
Andrei Elovikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 15:35:13 PST 2021
Author: Andrei Elovikov
Date: 2021-03-02T15:32:10-08:00
New Revision: b24afec8ae58be9fb26b4103e7fccf7580729c8b
URL: https://github.com/llvm/llvm-project/commit/b24afec8ae58be9fb26b4103e7fccf7580729c8b
DIFF: https://github.com/llvm/llvm-project/commit/b24afec8ae58be9fb26b4103e7fccf7580729c8b.diff
LOG: [NFCI][VPlan] Modify Recipes' print methods to honor Indent parameter
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D97787
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index e03effb085fa..007888e3a7f4 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9017,7 +9017,7 @@ void LoopVectorizationPlanner::adjustRecipesForInLoopReductions(
void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "\"INTERLEAVE-GROUP with factor " << IG->getFactor() << " at ";
+ O << Indent << "\"INTERLEAVE-GROUP with factor " << IG->getFactor() << " at ";
IG->getInsertPos()->printAsOperand(O, false);
O << ", ";
getAddr()->printAsOperand(O, SlotTracker);
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index fcb964efb973..ea4f0ac2e803 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -546,7 +546,7 @@ void VPInstruction::dump() const {
void VPInstruction::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "EMIT ";
+ O << Indent << "EMIT ";
if (hasResult()) {
printAsOperand(O, SlotTracker);
@@ -808,7 +808,9 @@ void VPlanPrinter::dumpBasicBlock(const VPBasicBlock *BasicBlock) {
for (const VPRecipeBase &Recipe : *BasicBlock) {
OS << " +\n" << Indent << "\"";
- Recipe.print(OS, Indent, SlotTracker);
+ // Don't indent inside the recipe printer as we printed it before the
+ // opening quote already.
+ Recipe.print(OS, "", SlotTracker);
OS << "\\l\"";
}
@@ -869,7 +871,7 @@ void VPlanPrinter::printAsIngredient(raw_ostream &O, const Value *V) {
void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN-CALL ";
+ O << Indent << "WIDEN-CALL ";
auto *CI = cast<CallInst>(getUnderlyingInstr());
if (CI->getType()->isVoidTy())
@@ -886,7 +888,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN-SELECT ";
+ O << Indent << "WIDEN-SELECT ";
printAsOperand(O, SlotTracker);
O << " = select ";
getOperand(0)->printAsOperand(O, SlotTracker);
@@ -899,7 +901,7 @@ void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN ";
+ O << Indent << "WIDEN ";
printAsOperand(O, SlotTracker);
O << " = " << getUnderlyingInstr()->getOpcodeName() << " ";
printOperands(O, SlotTracker);
@@ -907,7 +909,7 @@ void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN-INDUCTION";
+ O << Indent << "WIDEN-INDUCTION";
if (getTruncInst()) {
O << "\\l\"";
O << " +\n" << Indent << "\" " << VPlanIngredient(IV) << "\\l\"";
@@ -919,7 +921,7 @@ void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN-GEP ";
+ O << Indent << "WIDEN-GEP ";
O << (IsPtrLoopInvariant ? "Inv" : "Var");
size_t IndicesNumber = IsIndexLoopInvariant.size();
for (size_t I = 0; I < IndicesNumber; ++I)
@@ -933,12 +935,12 @@ void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN-PHI " << VPlanIngredient(getUnderlyingValue());
+ O << Indent << "WIDEN-PHI " << VPlanIngredient(getUnderlyingValue());
}
void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "BLEND ";
+ O << Indent << "BLEND ";
Phi->printAsOperand(O, false);
O << " =";
if (getNumIncomingValues() == 1) {
@@ -958,7 +960,7 @@ void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent,
void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "REDUCE ";
+ O << Indent << "REDUCE ";
printAsOperand(O, SlotTracker);
O << " = ";
getChainOp()->printAsOperand(O, SlotTracker);
@@ -974,7 +976,7 @@ void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << (IsUniform ? "CLONE " : "REPLICATE ");
+ O << Indent << (IsUniform ? "CLONE " : "REPLICATE ");
if (!getUnderlyingInstr()->getType()->isVoidTy()) {
printAsOperand(O, SlotTracker);
@@ -989,7 +991,7 @@ void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "PHI-PREDICATED-INSTRUCTION ";
+ O << Indent << "PHI-PREDICATED-INSTRUCTION ";
printAsOperand(O, SlotTracker);
O << " = ";
printOperands(O, SlotTracker);
@@ -997,7 +999,7 @@ void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent,
void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "WIDEN ";
+ O << Indent << "WIDEN ";
if (!isStore()) {
getVPValue()->printAsOperand(O, SlotTracker);
@@ -1035,7 +1037,7 @@ void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) {
void VPWidenCanonicalIVRecipe::print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const {
- O << "EMIT ";
+ O << Indent << "EMIT ";
getVPValue()->printAsOperand(O, SlotTracker);
O << " = WIDEN-CANONICAL-INDUCTION";
}
More information about the llvm-commits
mailing list