[llvm] d9fa186 - Scatter NDEBUG to fix after 838b4a533e6
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 12 09:13:35 PDT 2021
Author: Jeremy Morse
Date: 2021-10-12T17:13:15+01:00
New Revision: d9fa186a5cfe5527b086698a7a857e896193b85c
URL: https://github.com/llvm/llvm-project/commit/d9fa186a5cfe5527b086698a7a857e896193b85c
DIFF: https://github.com/llvm/llvm-project/commit/d9fa186a5cfe5527b086698a7a857e896193b85c.diff
LOG: 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.
Added:
Modified:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 2d0e7ac408b1..a790b9139469 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -755,6 +755,7 @@ class TransferTracker {
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<LocIdx> MLoc,
const DebugVariable &Var,
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 6ea88800ae7f..665cd58167bb 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -235,7 +235,9 @@ class DbgValue {
"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 @@ class MLocTracker {
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,
More information about the llvm-commits
mailing list