[PATCH] D99468: [TableGen] Emit more helpful error messages on empty type set

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 28 08:06:13 PDT 2021


arichardson created this revision.
arichardson added reviewers: kparzysz, craig.topper, arsenm.
Herald added a subscriber: jrtc27.
arichardson requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

I have seen this error quite frequently in our out-of-tree CHERI backends
and the lack of location information sometimes makes it quite difficult
to track down the actual source of the error.
This patch changes the llvm_unreachable() to a PrintFatalError() so that
tablegen prints a stack of source locations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99468

Files:
  llvm/utils/TableGen/CodeGenDAGPatterns.cpp


Index: llvm/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -841,7 +841,11 @@
               "(use -print-records with llvm-tblgen to see all "
               "expanded records).\n";
     Infer.TP.dump();
-    llvm_unreachable(nullptr);
+    dbgs() << "Generated from record:\n";
+    Infer.TP.getRecord()->dump();
+    PrintFatalError(Infer.TP.getRecord()->getLoc(),
+                    "Type set is empty for each HW mode in '" +
+                        Infer.TP.getRecord()->getName() + "'");
   }
 }
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99468.333725.patch
Type: text/x-patch
Size: 669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210328/5bec209d/attachment.bin>


More information about the llvm-commits mailing list