Skip to content

Commit f27cea7

Browse files
committed
Add way to omit debug-___location from MIR output
Summary: In lieu of a proper pass that strips debug info, add a way to omit debug-locations from the MIR output so that instructions with MMO's continue to match CHECK's when mir-debugify is used Reviewers: aprantl, bogner, vsk Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77575
1 parent 41ba801 commit f27cea7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ static cl::opt<bool> SimplifyMIR(
7979
"simplify-mir", cl::Hidden,
8080
cl::desc("Leave out unnecessary information when printing MIR"));
8181

82+
static cl::opt<bool> PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true),
83+
cl::desc("Print MIR debug-locations"));
84+
8285
namespace {
8386

8487
/// This structure describes how to print out stack object references.
@@ -819,11 +822,13 @@ void MIPrinter::print(const MachineInstr &MI) {
819822
NeedComma = true;
820823
}
821824

822-
if (const DebugLoc &DL = MI.getDebugLoc()) {
823-
if (NeedComma)
824-
OS << ',';
825-
OS << " debug-___location ";
826-
DL->printAsOperand(OS, MST);
825+
if (PrintLocations) {
826+
if (const DebugLoc &DL = MI.getDebugLoc()) {
827+
if (NeedComma)
828+
OS << ',';
829+
OS << " debug-___location ";
830+
DL->printAsOperand(OS, MST);
831+
}
827832
}
828833

829834
if (!MI.memoperands_empty()) {

0 commit comments

Comments
 (0)