<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [MemCpyOpt] Merge 7fb66d4035960b3c2797eae73d79b8478ff0348e into 13.0.0"
   href="https://bugs.llvm.org/show_bug.cgi?id=51791">51791</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[MemCpyOpt] Merge 7fb66d4035960b3c2797eae73d79b8478ff0348e into 13.0.0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fraser@codeplay.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>51236
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This patch fixes crashes on IR written with fairly simple code containing
scalable vector types. It's not a blocker but it'd be nice for us to have as we
are triggering this assertion in our downstream project.

Note that the actual patch in-tree depends on
17db125b487faa69d789b80d47b19da49522b168 which is just an optimization and
hasn't been merged into 13.0.0 (I don't think).

Therefore I created
<a href="https://github.com/frasercrmck/llvm-project/tree/scalable-memcpyopt">https://github.com/frasercrmck/llvm-project/tree/scalable-memcpyopt</a> which has
cherry-picked the patch onto the release branch. I ran check-llvm which passes.
Hopefully that makes things simpler for you.

commit 7fb66d4035960b3c2797eae73d79b8478ff0348e (HEAD -> main, origin/main)
Author: Fraser Cormack <<a href="mailto:fraser@codeplay.com">fraser@codeplay.com</a>>
Date:   Mon Sep 6 16:56:12 2021 +0100

    [MemCpyOpt] Fix a variety of scalable-type crashes

    This patch fixes a variety of crashes resulting from the `MemCpyOptPass`
    casting `TypeSize` to a constant integer, whether implicitly or
    explicitly.

    Since the `MemsetRanges` requires a constant size to work, all but one
    of the fixes in this patch simply involve skipping the various
    optimizations for scalable types as cleanly as possible.

    The optimization of `byval` parameters, however, has been updated to
    work on scalable types in theory. In practice, this optimization is only
    valid when the length of the `memcpy` is known to be larger than the
    scalable type size, which is currently never the case. This could
    perhaps be done in the future using the `vscale_range` attribute.

    Some implicit casts have been left as they were, under the knowledge
    they are only called on aggregate types. These should never be
    scalably-sized.

    Reviewed By: nikic, tra

    Differential Revision: <a href="https://reviews.llvm.org/D109329">https://reviews.llvm.org/D109329</a></pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 13.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=51236">Bug 51236</a>] [meta] 13.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>