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

    <tr>
        <th>Summary</th>
        <td>
            Tablegen "Unresolved bitvar reference" assertion failure
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            tablegen,
            crash
      </td>
    </tr>

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

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

<pre>
    With this test case:
```
class A<bit cond> {
  int x = 2;
  bits<16> y;
  let y{3-2} = !cond(cond : x, 1 : 0b00); }
def B : A<1>;
```
I get:
```
$ llvm-tblgen crash.td 
llvm-tblgen: /home/jayfoad2/git/llvm-project/llvm/lib/TableGen/Record.cpp:534: virtual llvm::Init *llvm::BitsInit::resolveReferences(llvm::Resolver &) const: Assertion `CachedBitVarResolved && "Unresolved bitvar reference"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU02P4zYM_TX0hVhDpuw4OfjgJONigR6K6bY964OJtVXsQJIHO_--kD1fHaAosIABmXwi-fierWJ014m5g-YIzblQSxrn0H1Xz5dZ2ULP9rn7y6UR0-giJo4JjYoMsgdxBtHDTrw8a2i8ihF7kCftEpp5siAfENrjBiO6KeEPBHlGAvmW1S5FkKdql28_fwA8J3yG9ii_ELTntQ6oWvvSPh8IsscfQCes1lehhQA6gDwitOetjeULHlc0E6tAPrxN-ET_K145_dduQDV6_3T7krS_8oQmqDiWyeIGf4DyKKBhnG8MNLxoSUDD1SWgYb15D_N3Nq9hPpwGGr4p7fkXnoCGRzZzsKW530H2jaxz1ycX0qL8yiPzlP3XySUE6t8zR5dizm5R4Dj7J37kCweeDEeg_fvdxw0NCLQDOmTHYlqVipFDcvOEsBMnZUa2R5f-VOGlwm4VOwSiP6bwmtQuPamA4XUaEAG1eFHOsy03oX779aH__QHjom8uoUK9XDHwfQ4J04xjSveYydGwCTYuujTz7YNQ_5bPxbjkrQZUk0U3Gb9YxjTyZhBqZf5OQRkuP7la2E7agzyogruqrURTtW1VF2NnheVGtkKzNRcr6HA4sLkIU1lqbWvawnUkqBayaqqm3su6JNoZa_dWX6TStbJQC74p58vMtZzDtVhZdvumrvaFV5p9XP84opQNz99MVuoERCvrHDXnInTrsnq5RqiFdzHF95bJJc_dt5f6_zcC1Zun2Y8lcLEE3_284Os2_wQAAP__CxZLEA">