On 1/21/2026 11:20 PM, 钟居哲 wrote:
Hi. Robin. Thanks for working on this bug.

As I remembered, the reason I put vleff intrinsic genereted into vleff + csrr vl in gimple level is because:

In this intrinsic code:

vleff (.... &vl, avl)
vadd (..., vl)

The assembly will become:

vleff ....
vadd ...

Instead of

vleff ....
csrr vl
vadd ...

The "csrr vl" will be elided.
Yea, but as structured you can't guarantee that VL will still be valid by the time you read it.


So I wonder, whether "csrr vl" can be elided after this patch ?
Unclear, I haven't had time to dive into it yet.  But I'd argue that correctness wins and the current implementation simply can't work in practice.   Though if modeled correctly, a CSR which sets VL where VL isn't used before it's set elsewhere should be removed by RTL DCE.

Jeff

Reply via email to