-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[TableGen] Remove unhelpful error messages from PseudoLoweringEmitter. #135747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
All of the notes using the location of ResultInst will just print the location inside of the PseudoInstExpansion class. There was one note using the location of DI->getDef(), but I don't think that one is particularly helpful either.
@llvm/pr-subscribers-tablegen Author: Craig Topper (topperc) ChangesAll of the notes using the location of ResultInst will just print the location inside of the PseudoInstExpansion class. There was one note using the location of DI->getDef(), but knowing where one of the two mismatched types is defined isn't helpful. The operand types need to be the same, so the mismatch message we already printed should be enough. Full diff: https://github.com/llvm/llvm-project/pull/135747.diff 1 Files Affected:
diff --git a/llvm/utils/TableGen/PseudoLoweringEmitter.cpp b/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
index 56b9e499cb4aa..7f67c13c0bbbd 100644
--- a/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
+++ b/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
@@ -90,14 +90,12 @@ unsigned PseudoLoweringEmitter::addDagOperandMapping(
// problem.
// FIXME: We probably shouldn't ever get a non-zero BaseIdx here.
assert(BaseIdx == 0 && "Named subargument in pseudo expansion?!");
- if (DI->getDef() != Insn.Operands[BaseIdx + i].Rec) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', operand type '" + DI->getDef()->getName() +
- "' does not match expansion operand type '" +
- Insn.Operands[BaseIdx + i].Rec->getName() + "'");
- PrintFatalNote(DI->getDef(),
- "Value was assigned at the following location:");
- }
+ if (DI->getDef() != Insn.Operands[BaseIdx + i].Rec)
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', operand type '" + DI->getDef()->getName() +
+ "' does not match expansion operand type '" +
+ Insn.Operands[BaseIdx + i].Rec->getName() +
+ "'");
// Source operand maps to destination operand. The Data element
// will be filled in later, just set the Kind for now. Do it
// for each corresponding MachineInstr operand, not just the first.
@@ -138,38 +136,26 @@ void PseudoLoweringEmitter::evaluateExpansion(const Record *Rec) {
LLVM_DEBUG(dbgs() << " Result: " << *Dag << "\n");
const DefInit *OpDef = dyn_cast<DefInit>(Dag->getOperator());
- if (!OpDef) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', result operator is not a record");
- PrintFatalNote(Rec->getValue("ResultInst"),
- "Result was assigned at the following location:");
- }
+ if (!OpDef)
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', result operator is not a record");
const Record *Operator = OpDef->getDef();
- if (!Operator->isSubClassOf("Instruction")) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', result operator '" + Operator->getName() +
- "' is not an instruction");
- PrintFatalNote(Rec->getValue("ResultInst"),
- "Result was assigned at the following location:");
- }
+ if (!Operator->isSubClassOf("Instruction"))
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', result operator '" + Operator->getName() +
+ "' is not an instruction");
CodeGenInstruction Insn(Operator);
- if (Insn.isCodeGenOnly || Insn.isPseudo) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', result operator '" + Operator->getName() +
- "' cannot be a pseudo instruction");
- PrintFatalNote(Rec->getValue("ResultInst"),
- "Result was assigned at the following location:");
- }
+ if (Insn.isCodeGenOnly || Insn.isPseudo)
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', result operator '" + Operator->getName() +
+ "' cannot be a pseudo instruction");
- if (Insn.Operands.size() != Dag->getNumArgs()) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', result operator '" + Operator->getName() +
- "' has the wrong number of operands");
- PrintFatalNote(Rec->getValue("ResultInst"),
- "Result was assigned at the following location:");
- }
+ if (Insn.Operands.size() != Dag->getNumArgs())
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', result operator '" + Operator->getName() +
+ "' has the wrong number of operands");
unsigned NumMIOperands = 0;
for (const auto &Op : Insn.Operands)
@@ -202,13 +188,10 @@ void PseudoLoweringEmitter::evaluateExpansion(const Record *Rec) {
continue;
StringMap<unsigned>::iterator SourceOp =
SourceOperands.find(Dag->getArgNameStr(i));
- if (SourceOp == SourceOperands.end()) {
- PrintError(Rec, "In pseudo instruction '" + Rec->getName() +
- "', output operand '" + Dag->getArgNameStr(i) +
- "' has no matching source operand");
- PrintFatalNote(Rec->getValue("ResultInst"),
- "Value was assigned at the following location:");
- }
+ if (SourceOp == SourceOperands.end())
+ PrintFatalError(Rec, "In pseudo instruction '" + Rec->getName() +
+ "', output operand '" + Dag->getArgNameStr(i) +
+ "' has no matching source operand");
// Map the source operand to the destination operand index for each
// MachineInstr operand.
for (unsigned I = 0, E = Insn.Operands[i].MINumOperands; I != E; ++I)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/12603 Here is the relevant piece of the build log for the reference
|
llvm#135747) All of the notes using the location of ResultInst will just print the location inside of the PseudoInstExpansion class. There was one note using the location of DI->getDef(), but knowing where one of the two mismatched types is defined isn't helpful. The operand types need to be the same, so the mismatch message we already printed should be enough.
All of the notes using the location of ResultInst will just print the location inside of the PseudoInstExpansion class.
There was one note using the location of DI->getDef(), but knowing where one of the two mismatched types is defined isn't helpful. The operand types need to be the same, so the mismatch message we already printed should be enough.