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

    <tr>
        <th>Summary</th>
        <td>
            Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V,
            crash-on-valid
      </td>
    </tr>

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

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

<pre>
    Reproducer:
```
; llc test.ll
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"

define i32 @main(ptr %p) {
entry:
 %0 = load i32, ptr %p, align 4
  %dec.i = add i32 %0, 1
  %1 = tail call i32 @llvm.ctpop.i32(i32 %dec.i)
  ret i32 %1
}
```
cc @topperc @RKSimon 

llvm version: 1a0e67d73023e7ad9e7e79f66afb43a6f2561d04

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU8GOozgQ_RpzsUC4DBgOHOhEWbW2pZG6e-ducIV4x7GRbdKd_fqVSdIzK-1lJGTMc71X5XqFDEHPFrEn9ROp95lc48n5XsXp85_rRzY6de1fcfFOrRN6wgdS7kk5kKa8P7dP_kSNmWjEEAtjbmCUfsZIlYzSyKtbIyV8TwkA5mfCB8wXwoem2pZcf20YtIQPDNrccrhhbwkD-I9s9Hox-JD0OkyXpspX-8O6D5sbbdfPfLbrF-22Kjxqi1RzoKQqz1JbAu0SPSVQLwQ6SsTTLRJt9Nev-6bzcktmnFSJT2BHfxJ3VBo9W1rdwxOscCr0xpFK3VJCXaZY9ksU2yKi1IZO0phHacZczsUUF7cUW7L2zt9ECXQPBY_xIX1XJWL_vx5NU9KNblnQb9vXP9_02Vn6a39SWnpBH7SzhA-UyRIboQQvgaOQqkOBojs2jTyOFZfNEeqGqfJ-7Uz1XHW8kxn2TLAWGLScZae-GVkFwFve4rFr67aumGjHo5A4cSFUmekeSqjKhgETUHJWlHXLYeRV0xxrwaAkVYlnqU2xNcb5OdMhrNh3NQiWGTmiCdsMA4xy-oFWET68Pr_t8u9pBGBHACYvwyl3Nr9Io1WC633m-6SYj-scUtt1iOFnjqijwX4IAX3UqVVNSaB9f3kuZozv1wWHKeEkjeewH_5I8M7ZiJ9xw7rk9rclwd-lWTFRHgddMj55_74N9Iv7QK_tnEaODynwBWdpKBE7Ih4i35bJqbvCg_78tr9zNp2dsyFKG3-D-IqzDhH9dgYNgSb9Un9Z_FxwiqioNmarJW7ls62hgh6lNqiKbPWmP8W4hKQGBwKHWcfTOhaTOxM4pGbeX_ni3d84RQKHzb1A4HAz8NLDvwEAAP__TkBLBA">