[llvm] r237008 - LiveRangeCalc: Improve error messages on malformed IR

Matthias Braun matze at braunis.de
Mon May 11 11:47:48 PDT 2015


Author: matze
Date: Mon May 11 13:47:47 2015
New Revision: 237008

URL: http://llvm.org/viewvc/llvm-project?rev=237008&view=rev
Log:
LiveRangeCalc: Improve error messages on malformed IR

Modified:
    llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp

Modified: llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp?rev=237008&r1=237007&r2=237008&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeCalc.cpp Mon May 11 13:47:47 2015
@@ -272,13 +272,19 @@ bool LiveRangeCalc::findReachingDefs(Liv
 #ifndef NDEBUG
     if (MBB->pred_empty()) {
       MBB->getParent()->verify();
+      errs() << "Use of " << PrintReg(PhysReg)
+             << " does not have a corresponding definition on every path:\n";
+      const MachineInstr *MI = Indexes->getInstructionFromIndex(Use);
+      if (MI != nullptr)
+        errs() << Use << " " << *MI;
       llvm_unreachable("Use not jointly dominated by defs.");
     }
 
     if (TargetRegisterInfo::isPhysicalRegister(PhysReg) &&
         !MBB->isLiveIn(PhysReg)) {
       MBB->getParent()->verify();
-      errs() << "The register needs to be live in to BB#" << MBB->getNumber()
+      errs() << "The register " << PrintReg(PhysReg)
+             << " needs to be live in to BB#" << MBB->getNumber()
              << ", but is missing from the live-in list.\n";
       llvm_unreachable("Invalid global physical register");
     }





More information about the llvm-commits mailing list