[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 09:30:32 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:
I worked a bit with AI agent to see why do we require this fix, when this function can be classified as a part of Semantic Analysis while parseCastOperand is related to parsing.
So I got some suggestions to make it more fixes when we come across null ptr. I shall check those and update this change by tomorrow.
Thank you
https://github.com/llvm/llvm-project/pull/161417
More information about the llvm-commits
mailing list