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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 07:12:40 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 168683 tests passed
* 3000 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.TableGen/invalid_typecast_assert.td</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 5
not /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-tblgen -gen-dag-isel -I /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/../../include /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td
# executed command: not /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-tblgen -gen-dag-isel -I /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/../../include /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:43:11: error: CHECK: expected string not found in input
# | // CHECK: [[@LINE+1]]:1: error: {{.*}} Type cast only takes one operand!
# |           ^
# | <stdin>:1:1: note: scanning from here
# | anonymous_14559: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:45:1: error: In anonymous_14559: Type cast only takes one operand!
# | ^
# | <stdin>:1:1: note: with "@LINE+1" equal to "44"
# | anonymous_14559: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:45:1: error: In anonymous_14559: Type cast only takes one operand!
# | ^
# | <stdin>:1:146: note: possible intended match here
# | anonymous_14559: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:45:1: error: In anonymous_14559: Type cast only takes one operand!
# |                                                                                                                                                  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: anonymous_14559: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:45:1: error: In anonymous_14559: Type cast only takes one operand! 
# | check:43'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:43'1                                                                                                                                                                                                 with "@LINE+1" equal to "44"
# | check:43'2                                                                                                                                                      ?                                          possible intended match
# |             2: def : Pat< 
# | check:43'0     ~~~~~~~~~~~
# |             3: ^ 
# | check:43'0     ~~
# |             4: anonymous_14559(val, src): (MY_LOAD:{ *:[i64] } ?:{}:$val, ?:{}:$src) 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/TableGen/invalid_typecast_assert.td:45:1: error: In anonymous_14559: cannot update node type from unknown operand! 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6: def : Pat< 
# | check:43'0     ~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list