[llvm] f27cea7 - Add way to omit debug-location from MIR output
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 16:22:18 PDT 2020
Author: Daniel Sanders
Date: 2020-04-06T16:22:01-07:00
New Revision: f27cea721e5893c112edfe1136973ed77064580b
URL: https://github.com/llvm/llvm-project/commit/f27cea721e5893c112edfe1136973ed77064580b
DIFF: https://github.com/llvm/llvm-project/commit/f27cea721e5893c112edfe1136973ed77064580b.diff
LOG: 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
Added:
Modified:
llvm/lib/CodeGen/MIRPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 58eb720ca799..0853181e7426 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -79,6 +79,9 @@ static cl::opt<bool> SimplifyMIR(
"simplify-mir", cl::Hidden,
cl::desc("Leave out unnecessary information when printing MIR"));
+static cl::opt<bool> PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true),
+ cl::desc("Print MIR debug-locations"));
+
namespace {
/// This structure describes how to print out stack object references.
@@ -819,11 +822,13 @@ void MIPrinter::print(const MachineInstr &MI) {
NeedComma = true;
}
- if (const DebugLoc &DL = MI.getDebugLoc()) {
- if (NeedComma)
- OS << ',';
- OS << " debug-location ";
- DL->printAsOperand(OS, MST);
+ if (PrintLocations) {
+ if (const DebugLoc &DL = MI.getDebugLoc()) {
+ if (NeedComma)
+ OS << ',';
+ OS << " debug-location ";
+ DL->printAsOperand(OS, MST);
+ }
}
if (!MI.memoperands_empty()) {
More information about the llvm-commits
mailing list