<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 - llvm-mca markers interfere with loop vectorization"
   href="https://bugs.llvm.org/show_bug.cgi?id=42173">42173</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-mca markers interfere with loop vectorization
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>max@marrone.nyc
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The docs for llvm-mca
(<a href="https://llvm.org/docs/CommandGuide/llvm-mca.html#using-markers-to-analyze-specific-code-blocks">https://llvm.org/docs/CommandGuide/llvm-mca.html#using-markers-to-analyze-specific-code-blocks</a>)
suggest using inline assembly to mark the region that llvm-mca should examine,
e.g.

<span class="quote">> for(size_t index = 0; index < count; index++)
> {
>     __asm volatile("# LLVM-MCA-BEGIN");
>     result += source[index];
>     __asm volatile("# LLVM-MCA-END");
> }</span >

However, these directives prevent auto-vectorization.

<span class="quote">> <source>:8:3: remark: loop not vectorized: call instruction cannot be
> vectorized [-Rpass-analysis=loop-vectorize]
>                 __asm volatile("# LLVM-MCA-BEGIN sum_marked");
>                 ^</span >

<span class="quote">> <source>:6:2: remark: loop not vectorized: read with atomic ordering or
> volatile read [-Rpass-analysis=loop-vectorize]
>         for (size_t index = 0; index < count; index++)
>         ^</span >

Compiler Explorer demo, on Clang 8.0.0: <a href="https://godbolt.org/z/NSQchu">https://godbolt.org/z/NSQchu</a>

We should be able to use llvm-mca markers without affecting optimization and
code generation.</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>