From d9fa186a5cfe5527b086698a7a857e896193b85c Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 12 Oct 2021 17:05:51 +0100 Subject: [PATCH] Scatter NDEBUG to fix after 838b4a533e6 These "dump" methods call into MachineOperand::dump, which doesn't exist with NDEBUG, thus we croak. Disable LiveDebugValues dump methods when NDEBUG is turned on to avoid this. --- llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp | 4 ++++ llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index 2d0e7ac..a790b91 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -755,6 +755,7 @@ public: ValueIDNum ValueIDNum::EmptyValue = {UINT_MAX, UINT_MAX, UINT_MAX}; +#ifndef NDEBUG void DbgValue::dump(const MLocTracker *MTrack) const { if (Kind == Const) { MO.dump(); @@ -771,6 +772,7 @@ void DbgValue::dump(const MLocTracker *MTrack) const { if (Properties.DIExpr) dbgs() << " " << *Properties.DIExpr; } +#endif MLocTracker::MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, @@ -862,6 +864,7 @@ std::string MLocTracker::IDAsString(const ValueIDNum &Num) const { return Num.asString(DefName); } +#ifndef NDEBUG LLVM_DUMP_METHOD void MLocTracker::dump() { for (auto Location : locations()) { std::string MLocName = LocIdxToName(Location.Value.getLoc()); @@ -876,6 +879,7 @@ LLVM_DUMP_METHOD void MLocTracker::dump_mloc_map() { dbgs() << "Idx " << Location.Idx.asU64() << " " << foo << "\n"; } } +#endif MachineInstrBuilder MLocTracker::emitLoc(Optional MLoc, const DebugVariable &Var, diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h index 6ea8880..665cd58 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h @@ -235,7 +235,9 @@ public: "Empty DbgValue constructor must pass in Undef kind"); } +#ifndef NDEBUG void dump(const MLocTracker *MTrack) const; +#endif bool operator==(const DbgValue &Other) const { if (std::tie(Kind, Properties) != std::tie(Other.Kind, Other.Properties)) @@ -527,9 +529,11 @@ public: std::string IDAsString(const ValueIDNum &Num) const; +#ifndef NDEBUG LLVM_DUMP_METHOD void dump(); LLVM_DUMP_METHOD void dump_mloc_map(); +#endif /// Create a DBG_VALUE based on machine location \p MLoc. Qualify it with the /// information in \pProperties, for variable Var. Don't insert it anywhere, -- 2.7.4