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

    <tr>
        <th>Summary</th>
        <td>
            Widened pointers not optimized back to scalar for vectorized interleaved accesses on RISC-V
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V,
            missed-optimization
      </td>
    </tr>

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

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

<pre>
    https://compiler-explorer.com/z/bcnocK139

In the loop f, the loop vectorizer is able to use a scalar address throughout the segmented accesses.

In g, where not every segmented field is written back to, it's kept around as a widened vector of pointers, even though we only use the first element of it.

`legalizeAndOptimizeInductions` in VPlanTransforms.cpp may not be catching this case.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcUs1u2zwQfBrqsrAhUZIVHXTwl8BA8B1atEV6psi1xIYiBe7Krv30BRWlCXoiiMXs_OwoIjt4xE7U_4n6KVMLjyF2bnlF1zZZH8ytG5lnEuVRyJOQJx2m2TqMO_w9uxAx7nWYhDzdhTz12gf9f1G2Ij-K_PjsgUcEF8IMZyEfP34X1ByivWMES6B6h8ABFkJQQFo5FUEZE5EIeIxhGcaw8AonHCb0jAaU1kiEtP9LNiSO64gRwQcGvGC8fQKcLTqT-K7RMqOHXulX4JBQloVsCF5xZlAxLN6AIlBwtQY9mk0whDPMwXrGSAmFF0wWkz64IgTvbquJJPRsIzGgw8SegJY3peKQOxyUs3c8evNlZjvZOz57s2i2wZM45GA9vHx1yv-IytM5xIn2ep5hUrfVWo-gFevR-gF4tARaEe4z05WmLVuVYVc0VZ0fqqqos7F7UNg_lEUjm0Mte9OWspR13rR1_iAL1WBmO5nLOq-KtpD5oa73lSrxrPq2KYq6QjyIKsdJWbd37jLtQxwyS7RgV5SHStaZUz06WkskZYoVvRHl8dvz98fdi5BSyEch5WSJ0OzCm2OVzKZZ_ZTFLu3d9ctAosqdJaYPJrbssPu5XeI9_zWHbRWa91u-t-cc4kfJDKwQh-ryqTcQPLwJzJbo_mn5YHlc-q3aScn27OYYfqFmIU9rACTkacvg0sk_AQAA___sjB0I">