diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index cfe1f1e9d7528..89a1d5362d789 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -483,6 +483,17 @@ class LLVM_ABI_FOR_TEST VPRecipeBase /// Set the recipe's debug location to \p NewDL. void setDebugLoc(DebugLoc NewDL) { DL = NewDL; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + /// Print the recipe, delegating to printRecipe(). + void print(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override final; + + /// Each concrete VPRecipe prints itself, without printing common information, + /// like debug info or metadata. + virtual void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const = 0; +#endif + protected: /// Compute the cost of this recipe either using a recipe's specialized /// implementation or using the legacy cost model and the underlying @@ -1130,8 +1141,8 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the VPInstruction to \p O. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; /// Print the VPInstruction to dbgs() (for debugging). LLVM_DUMP_METHOD void dump() const; @@ -1245,8 +1256,8 @@ class VPInstructionWithType : public VPInstruction { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -1337,8 +1348,8 @@ struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif protected: @@ -1383,8 +1394,8 @@ class VPIRInstruction : public VPRecipeBase { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif bool usesScalars(const VPValue *Op) const override { @@ -1430,8 +1441,8 @@ struct LLVM_ABI_FOR_TEST VPIRPhi : public VPIRInstruction, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif protected: @@ -1480,8 +1491,8 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -1533,8 +1544,8 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif Instruction::CastOps getOpcode() const { return Opcode; } @@ -1624,8 +1635,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif bool onlyFirstLaneUsed(const VPValue *Op) const override; @@ -1676,8 +1687,8 @@ class LLVM_ABI_FOR_TEST VPWidenCallRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -1720,8 +1731,8 @@ class VPHistogramRecipe : public VPRecipeBase { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -1750,8 +1761,8 @@ struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif unsigned getOpcode() const { return Instruction::Select; } @@ -1826,8 +1837,8 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -1897,8 +1908,8 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -1952,8 +1963,8 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -2013,8 +2024,8 @@ class LLVM_ABI_FOR_TEST VPHeaderPHIRecipe : public VPSingleDefRecipe, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override = 0; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override = 0; #endif /// Returns the start value of the phi, if one is set. @@ -2168,8 +2179,8 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif VPValue *getSplatVFValue() { @@ -2246,8 +2257,8 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -2291,8 +2302,8 @@ class LLVM_ABI_FOR_TEST VPWidenPHIRecipe : public VPSingleDefRecipe, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -2318,8 +2329,8 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -2378,8 +2389,8 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns the number of incoming values, also number of incoming blocks. @@ -2461,8 +2472,8 @@ class LLVM_ABI_FOR_TEST VPBlendRecipe : public VPSingleDefRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -2602,8 +2613,8 @@ class LLVM_ABI_FOR_TEST VPInterleaveRecipe final : public VPInterleaveBase { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif bool onlyFirstLaneUsed(const VPValue *Op) const override { @@ -2649,8 +2660,8 @@ class LLVM_ABI_FOR_TEST VPInterleaveEVLRecipe final : public VPInterleaveBase { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// The recipe only uses the first lane of the address, and EVL operand. @@ -2742,8 +2753,8 @@ class LLVM_ABI_FOR_TEST VPReductionRecipe : public VPRecipeWithIRFlags { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Return the recurrence kind for the in-loop reduction. @@ -2819,8 +2830,8 @@ class VPPartialReductionRecipe : public VPReductionRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -2852,8 +2863,8 @@ class LLVM_ABI_FOR_TEST VPReductionEVLRecipe : public VPReductionRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// The VPValue of the explicit vector length. @@ -2913,8 +2924,8 @@ class LLVM_ABI_FOR_TEST VPReplicateRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif bool isSingleScalar() const { return IsSingleScalar; } @@ -2971,8 +2982,8 @@ class LLVM_ABI_FOR_TEST VPBranchOnMaskRecipe : public VPRecipeBase { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override { + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override { O << Indent << "BRANCH-ON-MASK "; printOperands(O, SlotTracker); } @@ -3115,8 +3126,8 @@ class VPExpressionRecipe : public VPSingleDefRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if this expression contains recipes that may read from or @@ -3163,8 +3174,8 @@ class LLVM_ABI_FOR_TEST VPPredInstPHIRecipe : public VPSingleDefRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe uses scalars of operand \p Op. @@ -3292,8 +3303,8 @@ struct LLVM_ABI_FOR_TEST VPWidenLoadRecipe final : public VPWidenMemoryRecipe, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -3333,8 +3344,8 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -3374,8 +3385,8 @@ struct LLVM_ABI_FOR_TEST VPWidenStoreRecipe final : public VPWidenMemoryRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -3417,8 +3428,8 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns true if the recipe only uses the first lane of operand \p Op. @@ -3463,8 +3474,8 @@ class VPExpandSCEVRecipe : public VPSingleDefRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif const SCEV *getSCEV() const { return Expr; } @@ -3496,8 +3507,8 @@ class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif /// Returns the scalar type of the induction. @@ -3553,8 +3564,8 @@ class VPActiveLaneMaskPHIRecipe : public VPHeaderPHIRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -3596,8 +3607,8 @@ class VPEVLBasedIVPHIRecipe : public VPHeaderPHIRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -3631,8 +3642,8 @@ class VPWidenCanonicalIVRecipe : public VPSingleDefRecipe, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif }; @@ -3686,8 +3697,8 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif Type *getScalarType() const { @@ -3756,8 +3767,8 @@ class LLVM_ABI_FOR_TEST VPScalarIVStepsRecipe : public VPRecipeWithIRFlags, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override; + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override; #endif VPValue *getStepValue() const { return getOperand(1); } diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 1ee405a62aa68..626f002f99b77 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -409,8 +409,8 @@ void VPPartialReductionRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPPartialReductionRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPPartialReductionRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "PARTIAL-REDUCE "; printAsOperand(O, SlotTracker); O << " = " << Instruction::getOpcodeName(getOpcode()) << " "; @@ -470,6 +470,11 @@ FastMathFlags VPIRFlags::getFastMathFlags() const { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPSingleDefRecipe::dump() const { VPDef::dump(); } + +void VPRecipeBase::print(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { + printRecipe(O, Indent, SlotTracker); +} #endif template @@ -1346,11 +1351,11 @@ bool VPInstruction::onlyFirstPartUsed(const VPValue *Op) const { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPInstruction::dump() const { VPSlotTracker SlotTracker(getParent()->getPlan()); - print(dbgs(), "", SlotTracker); + printRecipe(dbgs(), "", SlotTracker); } -void VPInstruction::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPInstruction::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT" << (isSingleScalar() ? "-SCALAR" : "") << " "; if (hasResult()) { @@ -1485,8 +1490,8 @@ void VPInstructionWithType::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPInstructionWithType::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPInstructionWithType::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT" << (isSingleScalar() ? "-SCALAR" : "") << " "; printAsOperand(O, SlotTracker); O << " = "; @@ -1530,8 +1535,8 @@ void VPPhi::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPPhi::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPPhi::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT" << (isSingleScalar() ? "-SCALAR" : "") << " "; printAsOperand(O, SlotTracker); O << " = phi "; @@ -1573,8 +1578,8 @@ void VPIRInstruction::extractLastLaneOfFirstOperand(VPBuilder &Builder) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPIRInstruction::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPIRInstruction::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "IR " << I; } #endif @@ -1629,9 +1634,9 @@ void VPPhiAccessors::printPhiOperands(raw_ostream &O, #endif #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPIRPhi::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { - VPIRInstruction::print(O, Indent, SlotTracker); +void VPIRPhi::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { + VPIRInstruction::printRecipe(O, Indent, SlotTracker); if (getNumOperands() != 0) { O << " (extra operand" << (getNumOperands() > 1 ? "s" : "") << ": "; @@ -1716,8 +1721,8 @@ InstructionCost VPWidenCallRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenCallRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-CALL "; Function *CalledFn = getCalledScalarFunction(); @@ -1851,8 +1856,8 @@ bool VPWidenIntrinsicRecipe::onlyFirstLaneUsed(const VPValue *Op) const { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenIntrinsicRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenIntrinsicRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-INTRINSIC "; if (ResultTy->isVoidTy()) { O << "void "; @@ -1938,8 +1943,8 @@ InstructionCost VPHistogramRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPHistogramRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPHistogramRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-HISTOGRAM buckets: "; getOperand(0)->printAsOperand(O, SlotTracker); @@ -1957,8 +1962,8 @@ void VPHistogramRecipe::print(raw_ostream &O, const Twine &Indent, } } -void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenSelectRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-SELECT "; printAsOperand(O, SlotTracker); O << " = select "; @@ -2254,8 +2259,8 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN "; printAsOperand(O, SlotTracker); O << " = " << Instruction::getOpcodeName(Opcode); @@ -2334,8 +2339,8 @@ InstructionCost VPWidenCastRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenCastRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenCastRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-CAST "; printAsOperand(O, SlotTracker); O << " = " << Instruction::getOpcodeName(Opcode); @@ -2358,8 +2363,8 @@ static Constant *getSignedIntOrFpConstant(Type *Ty, int64_t C) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenIntOrFpInductionRecipe::printRecipe( + raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent; printAsOperand(O, SlotTracker); O << " = WIDEN-INDUCTION "; @@ -2383,8 +2388,8 @@ bool VPWidenIntOrFpInductionRecipe::isCanonical() const { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPDerivedIVRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPDerivedIVRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent; printAsOperand(O, SlotTracker); O << " = DERIVED-IV "; @@ -2491,8 +2496,8 @@ void VPScalarIVStepsRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPScalarIVStepsRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPScalarIVStepsRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent; printAsOperand(O, SlotTracker); O << " = SCALAR-STEPS "; @@ -2556,8 +2561,8 @@ void VPWidenGEPRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenGEPRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenGEPRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-GEP "; O << (isPointerLoopInvariant() ? "Inv" : "Var"); for (size_t I = 0; I < getNumOperands() - 1; ++I) @@ -2609,8 +2614,8 @@ void VPVectorEndPointerRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPVectorEndPointerRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPVectorEndPointerRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent; printAsOperand(O, SlotTracker); O << " = vector-end-pointer"; @@ -2634,8 +2639,8 @@ void VPVectorPointerRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPVectorPointerRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPVectorPointerRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent; printAsOperand(O, SlotTracker); O << " = vector-pointer "; @@ -2659,8 +2664,8 @@ InstructionCost VPBlendRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPBlendRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPBlendRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "BLEND "; printAsOperand(O, SlotTracker); O << " ="; @@ -2943,8 +2948,8 @@ bool VPExpressionRecipe::isSingleScalar() const { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPExpressionRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EXPRESSION "; printAsOperand(O, SlotTracker); O << " = "; @@ -3032,8 +3037,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent, } } -void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPReductionRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "REDUCE "; printAsOperand(O, SlotTracker); O << " = "; @@ -3052,8 +3057,8 @@ void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent, O << ")"; } -void VPReductionEVLRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPReductionEVLRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "REDUCE "; printAsOperand(O, SlotTracker); O << " = "; @@ -3412,8 +3417,8 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPReplicateRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << (IsSingleScalar ? "CLONE " : "REPLICATE "); if (!getUnderlyingInstr()->getType()->isVoidTy()) { @@ -3525,8 +3530,8 @@ void VPPredInstPHIRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPPredInstPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "PHI-PREDICATED-INSTRUCTION "; printAsOperand(O, SlotTracker); O << " = "; @@ -3617,8 +3622,8 @@ void VPWidenLoadRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenLoadRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenLoadRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN "; printAsOperand(O, SlotTracker); O << " = load "; @@ -3696,8 +3701,8 @@ InstructionCost VPWidenLoadEVLRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenLoadEVLRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenLoadEVLRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN "; printAsOperand(O, SlotTracker); O << " = vp.load "; @@ -3740,8 +3745,8 @@ void VPWidenStoreRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenStoreRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenStoreRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN store "; printOperands(O, SlotTracker); } @@ -3805,8 +3810,8 @@ InstructionCost VPWidenStoreEVLRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenStoreEVLRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenStoreEVLRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN vp.store "; printOperands(O, SlotTracker); } @@ -4069,8 +4074,8 @@ void VPInterleaveRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPInterleaveRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { const InterleaveGroup *IG = getInterleaveGroup(); O << Indent << "INTERLEAVE-GROUP with factor " << IG->getFactor() << " at "; IG->getInsertPos()->printAsOperand(O, false); @@ -4212,8 +4217,8 @@ void VPInterleaveEVLRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPInterleaveEVLRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPInterleaveEVLRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { const InterleaveGroup *IG = getInterleaveGroup(); O << Indent << "INTERLEAVE-GROUP with factor " << IG->getFactor() << " at "; IG->getInsertPos()->printAsOperand(O, false); @@ -4286,8 +4291,8 @@ InstructionCost VPInterleaveBase::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPCanonicalIVPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPCanonicalIVPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT "; printAsOperand(O, SlotTracker); O << " = CANONICAL-INDUCTION "; @@ -4301,8 +4306,8 @@ bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(bool IsScalable) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenPointerInductionRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenPointerInductionRecipe::printRecipe( + raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { assert((getNumOperands() == 3 || getNumOperands() == 5) && "unexpected number of operands"); O << Indent << "EMIT "; @@ -4321,8 +4326,8 @@ void VPWidenPointerInductionRecipe::print(raw_ostream &O, const Twine &Indent, } } -void VPExpandSCEVRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPExpandSCEVRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT "; printAsOperand(O, SlotTracker); O << " = EXPAND SCEV " << *Expr; @@ -4348,8 +4353,8 @@ void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenCanonicalIVRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenCanonicalIVRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EMIT "; printAsOperand(O, SlotTracker); O << " = WIDEN-CANONICAL-INDUCTION "; @@ -4396,8 +4401,8 @@ VPFirstOrderRecurrencePHIRecipe::computeCost(ElementCount VF, } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPFirstOrderRecurrencePHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPFirstOrderRecurrencePHIRecipe::printRecipe( + raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent << "FIRST-ORDER-RECURRENCE-PHI "; printAsOperand(O, SlotTracker); O << " = phi "; @@ -4431,8 +4436,8 @@ void VPReductionPHIRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPReductionPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPReductionPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-REDUCTION-PHI "; printAsOperand(O, SlotTracker); @@ -4451,8 +4456,8 @@ void VPWidenPHIRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPWidenPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPWidenPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "WIDEN-PHI "; printAsOperand(O, SlotTracker); @@ -4474,8 +4479,8 @@ void VPActiveLaneMaskPHIRecipe::execute(VPTransformState &State) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPActiveLaneMaskPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPActiveLaneMaskPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "ACTIVE-LANE-MASK-PHI "; printAsOperand(O, SlotTracker); @@ -4485,8 +4490,8 @@ void VPActiveLaneMaskPHIRecipe::print(raw_ostream &O, const Twine &Indent, #endif #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -void VPEVLBasedIVPHIRecipe::print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const { +void VPEVLBasedIVPHIRecipe::printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const { O << Indent << "EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI "; printAsOperand(O, SlotTracker); diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp index 59a9ea1a720b3..5766f42d2f78f 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp @@ -737,7 +737,7 @@ TEST_F(VPBasicBlockTest, print) { std::string I3Dump; raw_string_ostream OS(I3Dump); VPSlotTracker SlotTracker; - I3->print(OS, "", SlotTracker); + I3->printRecipe(OS, "", SlotTracker); EXPECT_EQ("EMIT br , ", I3Dump); } @@ -807,7 +807,7 @@ Successor(s): ir-bb std::string I3Dump; raw_string_ostream OS(I3Dump); VPSlotTracker SlotTracker(&Plan); - I3->print(OS, "", SlotTracker); + I3->printRecipe(OS, "", SlotTracker); EXPECT_EQ("EMIT br vp<%2>, vp<%3>", I3Dump); } @@ -1628,8 +1628,8 @@ struct VPDoubleValueDef : public VPRecipeBase { void execute(struct VPTransformState &State) override {} #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void print(raw_ostream &O, const Twine &Indent, - VPSlotTracker &SlotTracker) const override {} + void printRecipe(raw_ostream &O, const Twine &Indent, + VPSlotTracker &SlotTracker) const override {} #endif };