[llvm] r286190 - GlobalISel: improve error diagnostics when IRTranslation fails.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 17:12:18 PST 2016
Author: tnorthover
Date: Mon Nov 7 19:12:17 2016
New Revision: 286190
URL: http://llvm.org/viewvc/llvm-project?rev=286190&view=rev
Log:
GlobalISel: improve error diagnostics when IRTranslation fails.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=286190&r1=286189&r2=286190&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Mon Nov 7 19:12:17 2016
@@ -38,6 +38,13 @@ INITIALIZE_PASS_DEPENDENCY(TargetPassCon
INITIALIZE_PASS_END(IRTranslator, DEBUG_TYPE, "IRTranslator LLVM IR -> MI",
false, false)
+static void reportTranslationError(const Value &V, const Twine &Message) {
+ std::string ErrStorage;
+ raw_string_ostream Err(ErrStorage);
+ Err << Message << ": " << V << '\n';
+ report_fatal_error(Err.str());
+}
+
IRTranslator::IRTranslator() : MachineFunctionPass(ID), MRI(nullptr) {
initializeIRTranslatorPass(*PassRegistry::getPassRegistry());
}
@@ -67,7 +74,7 @@ unsigned IRTranslator::getOrCreateVReg(c
MachineFunctionProperties::Property::FailedISel);
return 0;
}
- report_fatal_error("unable to translate constant");
+ reportTranslationError(Val, "unable to translate constant");
}
}
}
@@ -661,9 +668,8 @@ bool IRTranslator::runOnMachineFunction(
for (const Instruction &Inst: BB) {
bool Succeeded = translate(Inst);
if (!Succeeded) {
- DEBUG(dbgs() << "Cannot translate: " << Inst << '\n');
if (TPC->isGlobalISelAbortEnabled())
- report_fatal_error("Unable to translate instruction");
+ reportTranslationError(Inst, "unable to translate instruction");
MF.getProperties().set(MachineFunctionProperties::Property::FailedISel);
break;
}
More information about the llvm-commits
mailing list