From 92205cb27fd80bcb605cc0a424c8d9e9dde374c5 Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Fri, 19 Mar 2021 09:41:44 -0700 Subject: [PATCH] [NFC][VPlan] Guard print routines with "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D98897 --- .../Vectorize/LoopVectorizationPlanner.h | 2 + .../Transforms/Vectorize/LoopVectorize.cpp | 4 ++ llvm/lib/Transforms/Vectorize/VPlan.cpp | 19 +++++- llvm/lib/Transforms/Vectorize/VPlan.h | 58 ++++++++++++++++--- llvm/lib/Transforms/Vectorize/VPlanSLP.cpp | 2 + llvm/lib/Transforms/Vectorize/VPlanValue.h | 6 ++ .../Transforms/Vectorize/VPlanHCFGTest.cpp | 2 + .../Transforms/Vectorize/VPlanTest.cpp | 6 ++ 8 files changed, 89 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h index fae75e318b42..70e1226e0ebf 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -256,7 +256,9 @@ public: /// best selected VPlan. void executePlan(InnerLoopVectorizer &LB, DominatorTree *DT); +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void printPlans(raw_ostream &O); +#endif /// Look through the existing plans and return true if we have one with all /// the vectorization factors in question. diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 61b6fa1bcc63..ea04ea3c45ee 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -7813,6 +7813,7 @@ void LoopVectorizationPlanner::executePlan(InnerLoopVectorizer &ILV, ILV.printDebugTracesAtEnd(); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void LoopVectorizationPlanner::printPlans(raw_ostream &O) { for (const auto &Plan : VPlans) if (PrintVPlansInDotFormat) @@ -7820,6 +7821,7 @@ void LoopVectorizationPlanner::printPlans(raw_ostream &O) { else Plan->print(O); } +#endif void LoopVectorizationPlanner::collectTriviallyDeadInstructions( SmallPtrSetImpl &DeadInstructions) { @@ -9017,6 +9019,7 @@ void LoopVectorizationPlanner::adjustRecipesForInLoopReductions( } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent << "INTERLEAVE-GROUP with factor " << IG->getFactor() << " at "; @@ -9032,6 +9035,7 @@ void VPInterleaveRecipe::print(raw_ostream &O, const Twine &Indent, if (Instruction *I = IG->getMember(i)) O << "\n" << Indent << " " << VPlanIngredient(I) << " " << i; } +#endif void VPWidenCallRecipe::execute(VPTransformState &State) { State.ILV->widenCallInstruction(*cast(getUnderlyingInstr()), this, diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index d8df4a710d88..321ab377aa8b 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -50,6 +50,7 @@ extern cl::opt EnableVPlanNativePath; #define DEBUG_TYPE "vplan" +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) raw_ostream &llvm::operator<<(raw_ostream &OS, const VPValue &V) { const VPInstruction *Instr = dyn_cast(&V); VPSlotTracker SlotTracker( @@ -57,6 +58,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const VPValue &V) { V.print(OS, SlotTracker); return OS; } +#endif Value *VPLane::getAsRuntimeExpr(IRBuilder<> &Builder, const ElementCount &VF) const { @@ -83,6 +85,7 @@ VPValue::~VPValue() { Def->removeDefinedValue(this); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPValue::print(raw_ostream &OS, VPSlotTracker &SlotTracker) const { if (const VPRecipeBase *R = dyn_cast_or_null(Def)) R->print(OS, "", SlotTracker); @@ -105,6 +108,7 @@ void VPDef::dump() const { print(dbgs(), "", SlotTracker); dbgs() << "\n"; } +#endif // Get the top-most entry block of \p Start. This is the entry block of the // containing VPlan. This function is templated to support both const and non-const blocks @@ -399,6 +403,7 @@ void VPBasicBlock::dropAllReferences(VPValue *NewValue) { } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPBasicBlock::print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent << getName() << ":\n"; @@ -434,6 +439,7 @@ void VPBasicBlock::print(raw_ostream &O, const Twine &Indent, O << '\n'; } } +#endif void VPRegionBlock::dropAllReferences(VPValue *NewValue) { for (VPBlockBase *Block : depth_first(Entry)) @@ -491,6 +497,7 @@ void VPRegionBlock::execute(VPTransformState *State) { State->Instance.reset(); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPRegionBlock::print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent << (isReplicator() ? " " : " ") << getName() << ": {"; @@ -501,6 +508,7 @@ void VPRegionBlock::print(raw_ostream &O, const Twine &Indent, } O << Indent << "}\n"; } +#endif void VPRecipeBase::insertBefore(VPRecipeBase *InsertPos) { assert(!Parent && "Recipe already in some VPBasicBlock"); @@ -601,6 +609,7 @@ void VPInstruction::execute(VPTransformState &State) { generateInstruction(State, Part); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPInstruction::dump() const { VPSlotTracker SlotTracker(getParent()->getPlan()); print(dbgs(), "", SlotTracker); @@ -641,6 +650,7 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent, Operand->printAsOperand(O, SlotTracker); } } +#endif /// Generate the code inside the body of the vectorized loop. Assumes a single /// LoopVectorBody basic-block was created for this. Introduce additional @@ -730,7 +740,7 @@ void VPlan::execute(VPTransformState *State) { L->getExitBlock()); } -// TODO: Wrap those in #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)/#endif. +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void VPlan::print(raw_ostream &O) const { VPSlotTracker SlotTracker(this); @@ -749,7 +759,6 @@ void VPlan::printDOT(raw_ostream &O) const { Printer.dump(); } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void VPlan::dump() const { print(dbgs()); } #endif @@ -794,6 +803,7 @@ void VPlan::updateDominatorTree(DominatorTree *DT, BasicBlock *LoopPreHeaderBB, assert(DT->verify(DominatorTree::VerificationLevel::Fast)); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) const Twine VPlanPrinter::getUID(const VPBlockBase *Block) { return (isa(Block) ? "cluster_N" : "N") + Twine(getOrCreateBID(Block)); @@ -1072,6 +1082,7 @@ void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent, printOperands(O, SlotTracker); } +#endif void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) { Value *CanonicalIV = State.CanonicalIV; @@ -1098,12 +1109,14 @@ void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) { } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPWidenCanonicalIVRecipe::print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const { O << Indent << "EMIT "; getVPValue()->printAsOperand(O, SlotTracker); O << " = WIDEN-CANONICAL-INDUCTION"; } +#endif template void DomTreeBuilder::Calculate(VPDominatorTree &DT); @@ -1122,6 +1135,7 @@ void VPValue::replaceAllUsesWith(VPValue *New) { } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPValue::printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const { if (const Value *UV = getUnderlyingValue()) { OS << "ir<"; @@ -1142,6 +1156,7 @@ void VPUser::printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const { Op->printAsOperand(O, SlotTracker); }); } +#endif void VPInterleavedAccessInfo::visitRegion(VPRegionBlock *Region, Old2NewTy &Old2New, diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 5a98c63401b0..f27628572ce0 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -573,10 +573,6 @@ public: /// Delete all blocks reachable from a given VPBlockBase, inclusive. static void deleteCFG(VPBlockBase *Entry); - void printAsOperand(raw_ostream &OS, bool PrintType) const { - OS << getName(); - } - /// Return true if it is legal to hoist instructions into this block. bool isLegalToHoistInto() { // There are currently no constraints that prevent an instruction to be @@ -588,6 +584,11 @@ public: /// replaces all uses of VPValues defined in the block with NewValue. virtual void dropAllReferences(VPValue *NewValue) = 0; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + void printAsOperand(raw_ostream &OS, bool PrintType) const { + OS << getName(); + } + /// Print plain-text dump of this VPBlockBase to \p O, prefixing all lines /// with \p Indent. \p SlotTracker is used to print unnamed VPValue's using /// consequtive numbers. @@ -604,7 +605,8 @@ public: } /// Dump this VPBlockBase to dbgs(). - void dump() const { print(dbgs()); } + LLVM_DUMP_METHOD void dump() const { print(dbgs()); } +#endif }; /// VPRecipeBase is a base class modeling a sequence of one or more output IR @@ -760,12 +762,14 @@ public: /// provided. void execute(VPTransformState &State) override; +#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; /// Print the VPInstruction to dbgs() (for debugging). - void dump() const; + LLVM_DUMP_METHOD void dump() const; +#endif /// Return true if this instruction may modify memory. bool mayWriteToMemory() const { @@ -819,9 +823,11 @@ public: /// Produce widened copies of all Ingredients. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A recipe for widening Call instructions. @@ -843,9 +849,11 @@ public: /// Produce a widened version of the call instruction. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A recipe for widening select instructions. @@ -872,9 +880,11 @@ public: /// Produce a widened version of the select instruction. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A recipe for handling GEP instructions. @@ -910,9 +920,11 @@ public: /// Generate the gep nodes. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A recipe for handling phi nodes of integer and floating-point inductions, @@ -943,9 +955,11 @@ public: /// needed by their users. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif /// Returns the start value of the induction. VPValue *getStartValue() { return getOperand(0); } @@ -1005,9 +1019,11 @@ public: /// Generate the phi/select nodes. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif /// Returns the start value of the phi, if it is a reduction. VPValue *getStartValue() { @@ -1063,9 +1079,11 @@ public: /// Generate the phi/select nodes. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// VPInterleaveRecipe is a recipe for transforming an interleave group of load @@ -1126,9 +1144,11 @@ public: /// Generate the wide load or store, and shuffles. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif const InterleaveGroup *getInterleaveGroup() { return IG; } }; @@ -1166,9 +1186,11 @@ public: /// Generate the reduction in the loop void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif /// The VPValue of the scalar Chain being accumulated. VPValue *getChainOp() const { return getOperand(0); } @@ -1226,9 +1248,11 @@ public: void setAlsoPack(bool Pack) { AlsoPack = Pack; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif bool isUniform() const { return IsUniform; } @@ -1255,6 +1279,7 @@ public: /// conditional branch. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override { @@ -1264,6 +1289,7 @@ public: else O << " All-One"; } +#endif /// Return the mask used by this recipe. Note that a full mask is represented /// by a nullptr. @@ -1296,9 +1322,11 @@ public: /// Generates phi nodes for live-outs as needed to retain SSA form. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A Recipe for widening load/store operations. @@ -1363,9 +1391,11 @@ public: /// Generate the wide load/store. void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// A Recipe for widening the canonical induction variable of the vector loop. @@ -1387,9 +1417,11 @@ public: /// step = . void execute(VPTransformState &State) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the recipe. void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; +#endif }; /// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It @@ -1474,6 +1506,7 @@ public: void dropAllReferences(VPValue *NewValue) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print this VPBsicBlock to \p O, prefixing all lines with \p Indent. \p /// SlotTracker is used to print unnamed VPValue's using consequtive numbers. /// @@ -1482,6 +1515,7 @@ public: void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; using VPBlockBase::print; // Get the print(raw_stream &O) version. +#endif private: /// Create an IR BasicBlock to hold the output instructions generated by this @@ -1575,6 +1609,7 @@ public: void dropAllReferences(VPValue *NewValue) override; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print this VPRegionBlock to \p O (recursively), prefixing all lines with /// \p Indent. \p SlotTracker is used to print unnamed VPValue's using /// consequtive numbers. @@ -1584,6 +1619,7 @@ public: void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override; using VPBlockBase::print; // Get the print(raw_stream &O) version. +#endif }; //===----------------------------------------------------------------------===// @@ -1836,6 +1872,7 @@ public: VPLoopInfo &getVPLoopInfo() { return VPLInfo; } const VPLoopInfo &getVPLoopInfo() const { return VPLInfo; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print this VPlan to \p O. void print(raw_ostream &O) const; @@ -1843,7 +1880,8 @@ public: void printDOT(raw_ostream &O) const; /// Dump the plan to stderr (for debugging). - void dump() const; + LLVM_DUMP_METHOD void dump() const; +#endif /// Returns a range mapping the values the range \p Operands to their /// corresponding VPValues. @@ -1863,6 +1901,7 @@ private: BasicBlock *LoopExitBB); }; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// VPlanPrinter prints a given VPlan to a given output stream. The printing is /// indented and follows the dot format. class VPlanPrinter { @@ -1909,7 +1948,7 @@ public: VPlanPrinter(raw_ostream &O, const VPlan &P) : OS(O), Plan(P), SlotTracker(&P) {} - void dump(); + LLVM_DUMP_METHOD void dump(); }; struct VPlanIngredient { @@ -1929,6 +1968,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const VPlan &Plan) { Plan.print(OS); return OS; } +#endif //===----------------------------------------------------------------------===// // VPlan Utilities @@ -2144,8 +2184,10 @@ class VPlanSlp { SmallPtrSetImpl &Candidates, VPInterleavedAccessInfo &IAI); +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print bundle \p Values to dbgs(). void dumpBundle(ArrayRef Values); +#endif public: VPlanSlp(VPInterleavedAccessInfo &IAI, VPBasicBlock &BB) : IAI(IAI), BB(BB) {} diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp index 39c879d45647..fd02805d971f 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.cpp @@ -349,6 +349,7 @@ SmallVector VPlanSlp::reorderMultiNodeOps() { return FinalOrder; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void VPlanSlp::dumpBundle(ArrayRef Values) { dbgs() << " Ops: "; for (auto Op : Values) { @@ -361,6 +362,7 @@ void VPlanSlp::dumpBundle(ArrayRef Values) { } dbgs() << "\n"; } +#endif VPInstruction *VPlanSlp::buildGraph(ArrayRef Values) { assert(!Values.empty() && "Need some operands!"); diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h index 55c2c748a5b9..81bd221432d4 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanValue.h +++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h @@ -116,11 +116,13 @@ public: /// for any other purpose, as the values may change as LLVM evolves. unsigned getVPValueID() const { return SubclassID; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const; void print(raw_ostream &OS, VPSlotTracker &Tracker) const; /// Dump the value to stderr (for debugging). void dump() const; +#endif unsigned getNumUsers() const { return Users.size(); } void addUser(VPUser &User) { Users.push_back(&User); } @@ -192,8 +194,10 @@ class VPUser { SmallVector Operands; protected: +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the operands to \p O. void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const; +#endif public: VPUser() {} @@ -347,12 +351,14 @@ public: /// for any other purpose, as the values may change as LLVM evolves. unsigned getVPDefID() const { return SubclassID; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Dump the VPDef to stderr (for debugging). void dump() const; /// Each concrete VPDef prints itself. virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const = 0; +#endif }; class VPlan; diff --git a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp index cf314043f011..853be5757731 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp @@ -89,6 +89,7 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) { EXPECT_EQ(IndvarAdd, ICmp->getOperand(0)); EXPECT_EQ(VecBB->getCondBit(), ICmp); +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) // Add an external value to check we do not print the list of external values, // as this is not required with the new printing. Plan->addVPValue(&*F->arg_begin()); @@ -131,6 +132,7 @@ compound=true } )"; EXPECT_EQ(ExpectedStr, FullDump); +#endif LoopVectorizationLegality::InductionList Inductions; SmallPtrSet DeadInstructions; diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp index 71f27f95bad7..2836e8199678 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp @@ -324,6 +324,7 @@ TEST(VPBasicBlockTest, getPlan) { } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) TEST(VPBasicBlockTest, print) { VPInstruction *I1 = new VPInstruction(Instruction::Add, {}); VPInstruction *I2 = new VPInstruction(Instruction::Sub, {I1}); @@ -422,6 +423,7 @@ No successors EXPECT_EQ("EMIT vp<%3> = mul vp<%1> vp<%0>", I4Dump); } } +#endif TEST(VPRecipeTest, CastVPInstructionToVPUser) { VPValue Op1; @@ -608,6 +610,7 @@ TEST(VPRecipeTest, CastVPWidenMemoryInstructionRecipeToVPUserAndVPDef) { delete Load; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) TEST(VPRecipeTest, dump) { VPlan Plan; VPBasicBlock *VPBB1 = new VPBasicBlock(); @@ -663,6 +666,7 @@ TEST(VPRecipeTest, dump) { delete AI; } +#endif TEST(VPRecipeTest, CastVPReductionRecipeToVPUser) { LLVMContext C; @@ -684,8 +688,10 @@ 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 {} +#endif }; TEST(VPDoubleValueDefTest, traverseUseLists) {