[llvm] [TableGen] Gracefully error out in ParseTreePattern when DAG has zero operands so that llvm-tblgen doesn't crash (PR #161417)

Prerona Chaudhuri via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 08:48:20 PST 2025


================
@@ -3608,10 +3619,15 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs(
     // If this is not a set, verify that the children nodes are not void typed,
     // and recurse.
     for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) {
-      if (Pat->getChild(i).getNumTypes() == 0)
+      TreePatternNodePtr Child = Pat->getChildShared(i);
+      if (!Child) {
+        I.error("child node at index " + Twine(i) + " is null!");
+        continue;
+      }
----------------
pchaudhuri-nv wrote:

No, this change is required for the existing test...

https://github.com/llvm/llvm-project/pull/161417


More information about the llvm-commits mailing list