https://bugs.llvm.org/show_bug.cgi?id=42173

            Bug ID: 42173
           Summary: llvm-mca markers interfere with loop vectorization
           Product: libraries
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedb...@nondot.org
          Reporter: m...@marrone.nyc
                CC: llvm-bugs@lists.llvm.org

The docs for llvm-mca
(https://llvm.org/docs/CommandGuide/llvm-mca.html#using-markers-to-analyze-specific-code-blocks)
suggest using inline assembly to mark the region that llvm-mca should examine,
e.g.

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

However, these directives prevent auto-vectorization.

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

> <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++)
>         ^

Compiler Explorer demo, on Clang 8.0.0: https://godbolt.org/z/NSQchu

We should be able to use llvm-mca markers without affecting optimization and
code generation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to