<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/120631>120631</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Codegen Crash: UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1247!
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          allight
      </td>
    </tr>
</table>

<pre>
    If one attempts to codegen this llvm IR (generated from https://github.com/google/xls/issues/1776 optimized with opt -O3 and then reduced using llvm-reduce) the codegenerator will crash (on x86-64)

[sample.reduced.ll](https://github.com/user-attachments/files/18202728/sample.reduced.ll.txt)
[sample.ir.opt.ll](https://github.com/user-attachments/files/18202757/sample.ir.opt.ll.txt)


```
% opt /tmp/sample.ir.ll -o /tmp/sample.ir.opt.ll -O3

% llc /tmp/sample.ir.opt.ll -o /tmp/a.out -O3
t802: ch = <<Deleted Node!>>
This target-independent node should have been selected!
UNREACHABLE executed at third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1247!
PLEASE submit a bug report to http://go/llvm-crash-bug and include the crash backtrace.
Stack dump:
0.      Program arguments: /.../blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/llvm/llc /tmp/sample.ir.opt.ll -o /tmp/a.out -O3
1.      Running pass 'Function Pass Manager' on module '/tmp/sample.ir.opt.ll'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@____sample__main_partition_0'

% llc --version
LLVM (http://llvm.org/):
  LLVM version google3-trunk 59890c13343af9e308281b3c76bac425087f4f8a
  Optimized build with assertions.
  Default target: x86_64-grtev4-linux-gnu
  Host CPU: skylake-avx512

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
 arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    hexagon    - Hexagon
    lanai      - Lanai
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc32le    - PowerPC 32 LE
    ppc64      - PowerPC 64
 ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
 riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    wasm32     - WebAssembly 32-bit
    wasm64     - WebAssembly 64-bit
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVl1vozwW_jXOzRERGALkIhdMPtpK7bxRpzObu8jACXhrbGSbNPP--pWBfHRmWml33wqpsc9znvNp-zBjeCURF2T2hcxWE9bZWukFE4JXtZ3kqvy5eDiAkgjMWmxaa8AqKFSJFUqwNTcgxLGBh2cgNK1QomYWSzho1UBtbWtImBG6IXRTcVt3-bRQjVsoVQkkdHMShtANN6ZD9yNIkhhUa3nD_8YS3rit3RK8v0JgsgRbowSNZVdgCZ3hsurte8MWoXOHOPvnfFEa3rgQUGhmauejknBKYy-OCJ0TP3Pf7IthTStwOhJPhSCzFaHpJwF0BrXHrGVF3aC0zvcDF0MMKfVpQlNCN7_xTu3JjoYvVrmeqtb-I0ZnydXohfbG5vDF_vj5GaGzPr-EbmzTvlMWAjz1J8HA6koy8tEZCFF8Br3hYVPV2VHZpj4lYQZFDSRcAQmXJFyuUKBroa-qREIDEq7d52cvrtks0xVaj8sSW5QlSgtSlQimVp0ooWZHhBxRgkGBhcXSMfjZ96_P62x5n315XAOesOicAWZdA-ty3zJtfxK6cZ00_vNarf6Nhb3Z5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