<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 - Loops with parallel metadata shouldn't assume that loads are safe to hoist out of conditionals"
   href="https://bugs.llvm.org/show_bug.cgi?id=46666">46666</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Loops with parallel metadata shouldn't assume that loads are safe to hoist out of conditionals
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>wala1@illinois.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There's an assumption/requirement that loads that are annotated inside loops
with llvm.loop.parallel_accesses metadata should be safe to hoist out of
conditionals. See, for instance LoopVectorizationLegality::blockCanBePredicated
in LoopVectorizationLegality.cpp. This requirement isn't documented in the LLVM
language reference manual page.

This bug report is to request that this requirement be removed from the code,
so that loads that are unsafe to hoist out of conditionals can still be
annotated, and hence a loop with such loads can still be considered parallel.
There are three reasons why this requirement doesn't make a lot of sense:

1) There's no logical connection between this requirement and the other meaning
of llvm.loop.parallel_accesses metadata, which is that the iterations are free
of loop-carried dependencies.
2) It makes it harder to lower code for parallel languages mapping onto LLVM
that don't have this requirement, such as OpenCL. See
<a href="https://github.com/pocl/pocl/issues/757">https://github.com/pocl/pocl/issues/757</a> for an example of a potential crash
caused by this.
3) LLVM supports masked loads, which can be used as an alternative to hoisting
the load of the conditional.

The downside to removing this requirement is a potential performance impact on
existing code that makes use of it to avoid generating masked loads.</pre>
        </div>
      </p>


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

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