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 +`_ 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 ------------------