Index: lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- lib/CodeGen/CodeGenPrepare.cpp +++ lib/CodeGen/CodeGenPrepare.cpp @@ -2619,6 +2619,7 @@ } #endif +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void ExtAddrMode::print(raw_ostream &OS) const { bool NeedPlus = false; OS << "["; @@ -2650,7 +2651,6 @@ OS << ']'; } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void ExtAddrMode::dump() const { print(dbgs()); dbgs() << '\n'; Index: lib/CodeGen/LiveDebugVariables.cpp =================================================================== --- lib/CodeGen/LiveDebugVariables.cpp +++ lib/CodeGen/LiveDebugVariables.cpp @@ -366,6 +366,7 @@ } } +#ifndef NDEBUG void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { auto *DV = cast(Variable); OS << "!\""; @@ -393,6 +394,7 @@ for (unsigned i = 0, e = userValues.size(); i != e; ++i) userValues[i]->print(OS, TRI); } +#endif void UserValue::coalesceLocation(unsigned LocNo) { unsigned KeepLoc = 0; Index: lib/CodeGen/MachinePipeliner.cpp =================================================================== --- lib/CodeGen/MachinePipeliner.cpp +++ lib/CodeGen/MachinePipeliner.cpp @@ -3960,6 +3960,7 @@ DEBUG(dump();); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Print the schedule information to the given output. void SMSchedule::print(raw_ostream &os) const { // Iterate over each cycle. @@ -3975,7 +3976,6 @@ } } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Utility function used for debugging to print the schedule. LLVM_DUMP_METHOD void SMSchedule::dump() const { print(dbgs()); } #endif Index: lib/CodeGen/WinEHPrepare.cpp =================================================================== --- lib/CodeGen/WinEHPrepare.cpp +++ lib/CodeGen/WinEHPrepare.cpp @@ -1014,6 +1014,7 @@ removeUnreachableBlocks(F); } +#ifndef NDEBUG void WinEHPrepare::verifyPreparedFunclets(Function &F) { for (BasicBlock &BB : F) { size_t NumColors = BlockColors[&BB].size(); @@ -1026,6 +1027,7 @@ "EH Pad still has a PHI!"); } } +#endif bool WinEHPrepare::prepareExplicitEH(Function &F) { // Remove unreachable blocks. It is not valuable to assign them a color and Index: lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp =================================================================== --- lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp +++ lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp @@ -250,7 +250,8 @@ return phiInfoElementGetSources(findPHIInfoElement(DestReg)).size(); } -void PHILinearize::dump(MachineRegisterInfo *MRI) { +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) +LLVM_DUMP_METHOD void PHILinearize::dump(MachineRegisterInfo *MRI) { const TargetRegisterInfo *TRI = MRI->getTargetRegisterInfo(); dbgs() << "=PHIInfo Start=\n"; for (auto PII : this->PHIInfo) { @@ -265,6 +266,7 @@ } dbgs() << "=PHIInfo End=\n"; } +#endif void PHILinearize::clear() { PHIInfo = PHIInfoT(); } @@ -839,6 +841,7 @@ } } +#ifndef NDEBUG void LinearizedRegion::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { OS << "Linearized Region {"; bool IsFirst = true; @@ -859,6 +862,7 @@ } OS << "} \n"; } +#endif unsigned LinearizedRegion::getBBSelectRegIn() { return getRegionMRT()->getBBSelectRegIn(); Index: lib/Target/AMDGPU/AMDILCFGStructurizer.cpp =================================================================== --- lib/Target/AMDGPU/AMDILCFGStructurizer.cpp +++ lib/Target/AMDGPU/AMDILCFGStructurizer.cpp @@ -1168,6 +1168,7 @@ return Num; } +#ifndef NDEBUG void AMDGPUCFGStructurizer::showImproveSimpleJumpintoIf( MachineBasicBlock *HeadMBB, MachineBasicBlock *TrueMBB, MachineBasicBlock *FalseMBB, MachineBasicBlock *LandMBB, bool Detail) { @@ -1209,6 +1210,7 @@ dbgs() << "\n"; } +#endif int AMDGPUCFGStructurizer::improveSimpleJumpintoIf(MachineBasicBlock *HeadMBB, MachineBasicBlock *TrueMBB, MachineBasicBlock *FalseMBB, Index: lib/Target/Hexagon/HexagonConstPropagation.cpp =================================================================== --- lib/Target/Hexagon/HexagonConstPropagation.cpp +++ lib/Target/Hexagon/HexagonConstPropagation.cpp @@ -602,11 +602,13 @@ return Ps; } +#ifndef NDEBUG void MachineConstPropagator::CellMap::print(raw_ostream &os, const TargetRegisterInfo &TRI) const { for (auto &I : Map) dbgs() << " " << PrintReg(I.first, &TRI) << " -> " << I.second << '\n'; } +#endif void MachineConstPropagator::visitPHI(const MachineInstr &PN) { const MachineBasicBlock *MB = PN.getParent(); Index: lib/Transforms/IPO/SampleProfile.cpp =================================================================== --- lib/Transforms/IPO/SampleProfile.cpp +++ lib/Transforms/IPO/SampleProfile.cpp @@ -423,6 +423,7 @@ 0xffff; } +#ifndef NDEBUG /// \brief Print the weight of edge \p E on stream \p OS. /// /// \param OS Stream to emit the output to. @@ -453,6 +454,7 @@ uint64_t W = (I == BlockWeights.end() ? 0 : I->second); OS << "weight[" << BB->getName() << "]: " << W << "\n"; } +#endif /// \brief Get the weight for an instruction. /// Index: lib/Transforms/Scalar/GuardWidening.cpp =================================================================== --- lib/Transforms/Scalar/GuardWidening.cpp +++ lib/Transforms/Scalar/GuardWidening.cpp @@ -664,6 +664,7 @@ return PA; } +#ifndef NDEBUG StringRef GuardWideningImpl::scoreTypeToString(WideningScore WS) { switch (WS) { case WS_IllegalOrNegative: @@ -678,6 +679,7 @@ llvm_unreachable("Fully covered switch above!"); } +#endif char GuardWideningLegacyPass::ID = 0; Index: lib/Transforms/Scalar/LoopStrengthReduce.cpp =================================================================== --- lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -195,11 +195,11 @@ } // end anonymous namespace +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void RegSortData::print(raw_ostream &OS) const { OS << "[NumUses=" << UsedByIndices.count() << ']'; } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void RegSortData::dump() const { print(errs()); errs() << '\n'; } @@ -1350,6 +1350,7 @@ return TTI.isLSRCostLess(C, Other.C); } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void Cost::print(raw_ostream &OS) const { if (InsnsCost) OS << C.Insns << " instruction" << (C.Insns == 1 ? " " : "s "); @@ -1370,7 +1371,6 @@ OS << ", plus " << C.SetupCost << " setup cost"; } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void Cost::dump() const { print(errs()); errs() << '\n'; } @@ -3859,12 +3859,12 @@ } // end anonymous namespace +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void WorkItem::print(raw_ostream &OS) const { OS << "in formulae referencing " << *OrigReg << " in use " << LUIdx << " , add offset " << Imm; } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void WorkItem::dump() const { print(errs()); errs() << '\n'; } @@ -5364,13 +5364,13 @@ } } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) void LSRInstance::print(raw_ostream &OS) const { print_factors_and_types(OS); print_fixups(OS); print_uses(OS); } -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void LSRInstance::dump() const { print(errs()); errs() << '\n'; }