[PATCH] D63040: [Docs] [llvm-mca] Point out a caveat for using llvm-mca markers in source code.

Max Marrone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 18:54:14 PDT 2019


Maxpm created this revision.
Maxpm added a project: LLVM.
Herald added subscribers: llvm-commits, gbedwell, tschuett.
Herald added a reviewer: andreadb.

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


Repository:
  rL LLVM

https://reviews.llvm.org/D63040

Files:
  llvm/docs/CommandGuide/llvm-mca.rst


Index: llvm/docs/CommandGuide/llvm-mca.rst
===================================================================
--- llvm/docs/CommandGuide/llvm-mca.rst
+++ llvm/docs/CommandGuide/llvm-mca.rst
@@ -241,6 +241,9 @@
 Note that multiple anonymous regions cannot overlap. Also, overlapping regions
 cannot have the same name.
 
+USING MARKERS IN SOURCE CODE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 Inline assembly directives may be used from source code to annotate the
 assembly text:
 
@@ -254,6 +257,17 @@
     return a;
   }
 
+However, currently, `this interferes with optimizations like loop vectorization
+<https://bugs.llvm.org/show_bug.cgi?id=42173>`_ and changes the code that is generated.
+This is because the ``__asm`` statements are seen as real code having important side
+effects, which limits how the code around them can be transformed.
+
+It is generally safe to use source-level markers in straight-line source code without
+any control flow, like the example above.  Otherwise, you must take care to make
+sure that the code you are analyzing is the same as the code the compiler actually
+wants to generate.  Unfortunately, the only robust way to do this is to manually
+add the markers to the assembly text.
+
 HOW LLVM-MCA WORKS
 ------------------
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63040.203663.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190608/1180bca3/attachment-0001.bin>


More information about the llvm-commits mailing list