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

    <tr>
        <th>Summary</th>
        <td>
            RISCV64 backend "Invalid size request on a scalable vector"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          patrick-rivos
      </td>
    </tr>
</table>

<pre>
    Testcase:
```c
unsigned a;
int *b;
long c;
int d;
short g;
void h() {
  long e = 0;
  long f = 0;
  for (; c; c++) {
    g = d;
    f = a >> g;
    e = f & -f ^ f ? 0 : f;
    *b = e;
 }
}
```
Command:
```
> /scratch/tc-testing/llvm-jan-30/build/bin/clang -O3 -march=rv64gcv red.c
fatal error: error in backend: Invalid size request on a scalable vector.
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 1d3300d5027c95c84b335f6adfca7e49cae45bb2)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /scratch/tc-testing/llvm-jan-30/build/bin
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /scratch/tmp/red-19107d.c
clang: note: diagnostic msg: /scratch/tmp/red-19107d.sh
clang: note: diagnostic msg:

********************
```
Godbolt:
https://godbolt.org/z/s81sETxo1

Bugpoint:
[bugpoint.zip](https://github.com/llvm/llvm-project/files/14172075/bugpoint.zip)

Found via fuzzer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVVFz4yYQ_jX4ZUcehCTLfvCDHVu5zGSaTOK2zwhWMhcMLiBdml_fQXKU5O6hTe9mGBmW5ePbb3cx9161BnFNii0pdjPehaN16zMPTomnxKne-llt5d_rA_oguEeSbQjdEbohCzoOMa47M0BJ4CTb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