[llvm] r269239 - MachineVerifier: Fix error reporting.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 14:31:39 PDT 2016
Author: matze
Date: Wed May 11 16:31:39 2016
New Revision: 269239
URL: http://llvm.org/viewvc/llvm-project?rev=269239&view=rev
Log:
MachineVerifier: Fix error reporting.
Do not use getVRegDef() to print "the definition" of a vreg. If there
are multiple or none the function will fail.
Modified:
llvm/trunk/lib/CodeGen/MachineVerifier.cpp
Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=269239&r1=269238&r2=269239&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Wed May 11 16:31:39 2016
@@ -221,6 +221,7 @@ namespace {
void report_context_liverange(const LiveRange &LR) const;
void report_context_regunit(unsigned RegUnit) const;
void report_context_lanemask(LaneBitmask LaneMask) const;
+ void report_context_vreg(unsigned VReg) const;
void report_context_vreg_regunit(unsigned VRegOrRegUnit) const;
void verifyInlineAsm(const MachineInstr *MI);
@@ -498,9 +499,13 @@ void MachineVerifier::report_context_reg
errs() << "- regunit: " << PrintRegUnit(RegUnit, TRI) << '\n';
}
+void MachineVerifier::report_context_vreg(unsigned VReg) const {
+ errs() << "- v. register: " << PrintReg(VReg, TRI) << '\n';
+}
+
void MachineVerifier::report_context_vreg_regunit(unsigned VRegOrUnit) const {
if (TargetRegisterInfo::isVirtualRegister(VRegOrUnit)) {
- errs() << "- v. register: " << PrintReg(VRegOrUnit, TRI) << '\n';
+ report_context_vreg(VRegOrUnit);
} else {
errs() << "- regunit: " << PrintRegUnit(VRegOrUnit, TRI) << '\n';
}
@@ -1513,9 +1518,10 @@ void MachineVerifier::visitMachineFuncti
BBInfo &MInfo = MBBInfoMap[&MF->front()];
for (RegSet::iterator
I = MInfo.vregsRequired.begin(), E = MInfo.vregsRequired.end(); I != E;
- ++I)
- report("Virtual register def doesn't dominate all uses.",
- MRI->getVRegDef(*I));
+ ++I) {
+ report("Virtual register defs don't dominate all uses.", MF);
+ report_context_vreg(*I);
+ }
}
if (LiveVars)
More information about the llvm-commits
mailing list