summaryrefslogtreecommitdiff
path: root/llvm/docs
diff options
context:
space:
mode:
authorMichael Kruse <llvm-project@meinersbur.de>2025-01-03 10:22:51 +0100
committerMichael Kruse <llvm-project@meinersbur.de>2025-01-03 10:22:51 +0100
commit38500d63e14ce340236840f60d356cdefb56a52c (patch)
tree17edbec446ce9b50d2f215a483b83afb293a635d /llvm/docs
parent1a3d5daaef7a6a63448a497da3eff7fc9e23df26 (diff)
parent27f30029741ecf023baece7b3dde1ff9011ffefc (diff)
Merge branch 'main' into users/meinersbur/flang_runtime_split-headersusers/meinersbur/flang_runtime_split-headers
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/AMDGPUUsage.rst8
-rw-r--r--llvm/docs/CommandGuide/llvm-exegesis.rst8
-rw-r--r--llvm/docs/CommandGuide/llvm-mc.rst4
-rw-r--r--llvm/docs/CommandGuide/llvm-objcopy.rst100
-rw-r--r--llvm/docs/Contributing.rst22
-rw-r--r--llvm/docs/Coroutines.rst22
-rw-r--r--llvm/docs/DirectX/DXILResources.rst60
-rw-r--r--llvm/docs/ExceptionHandling.rst10
-rw-r--r--llvm/docs/GettingInvolved.rst5
-rw-r--r--llvm/docs/GettingStarted.rst2
-rw-r--r--llvm/docs/GitHub.rst22
-rw-r--r--llvm/docs/GlobalISel/GenericOpcode.rst6
-rw-r--r--llvm/docs/GlobalISel/Legalizer.rst4
-rw-r--r--llvm/docs/MemTagSanitizer.rst13
-rw-r--r--llvm/docs/NVPTXUsage.rst90
-rw-r--r--llvm/docs/RISCV/RISCVVectorExtension.rst3
-rw-r--r--llvm/docs/RISCVUsage.rst12
-rw-r--r--llvm/docs/Reference.rst4
-rw-r--r--llvm/docs/ReleaseNotes.md28
-rw-r--r--llvm/docs/SPIRVUsage.rst6
-rw-r--r--llvm/docs/Security.rst92
-rw-r--r--llvm/docs/StackMaps.rst5
-rw-r--r--llvm/docs/TableGen/ProgRef.rst19
-rw-r--r--llvm/docs/Telemetry.rst257
-rw-r--r--llvm/docs/TestSuiteGuide.md13
-rw-r--r--llvm/docs/UndefinedBehavior.rst440
-rw-r--r--llvm/docs/UserGuides.rst4
-rw-r--r--llvm/docs/Vectorizers.rst23
-rw-r--r--llvm/docs/llvm_telemetry_design.pngbin0 -> 94604 bytes
-rw-r--r--llvm/docs/requirements-hashed.txt5
-rw-r--r--llvm/docs/requirements.txt1
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst8
-rw-r--r--llvm/docs/vplan-early-exit.dot41
-rw-r--r--llvm/docs/vplan-early-exit.pngbin0 -> 131943 bytes
34 files changed, 1171 insertions, 166 deletions
diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index c076b877bc8a..5c6034753eb4 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -1376,6 +1376,8 @@ The AMDGPU backend implements the following LLVM IR intrinsics.
0. Interleave DS and MFMA instructions for small GEMM kernels.
1. Interleave DS and MFMA instructions for single wave small GEMM kernels.
+ 2. Interleave TRANS and MFMA instructions, as well as their VALU and DS predecessors, for attention kernels.
+ 3. Interleave TRANS and MFMA instructions, with no predecessor interleaving, for attention kernels.
Only one iglp_opt intrinsic may be used in a scheduling region. The iglp_opt intrinsic
cannot be combined with sched_barrier or sched_group_barrier.
@@ -5754,9 +5756,6 @@ SGPR register initial state is defined in
then Flat Scratch Init 2 See
(enable_sgpr_flat_scratch :ref:`amdgpu-amdhsa-kernel-prolog-flat-scratch`.
_init)
- then Preloaded Kernargs N/A See
- (kernarg_preload_spec :ref:`amdgpu-amdhsa-kernarg-preload`.
- _length)
then Private Segment Size 1 The 32-bit byte size of a
(enable_sgpr_private single work-item's memory
_segment_size) allocation. This is the
@@ -5777,6 +5776,9 @@ SGPR register initial state is defined in
may be needed for GFX9-GFX11 which
changes the meaning of the
Flat Scratch Init value.
+ then Preloaded Kernargs N/A See
+ (kernarg_preload_spec :ref:`amdgpu-amdhsa-kernarg-preload`.
+ _length)
then Work-Group Id X 1 32-bit work-group id in X
(enable_sgpr_workgroup_id dimension of grid for
_X) wavefront.
diff --git a/llvm/docs/CommandGuide/llvm-exegesis.rst b/llvm/docs/CommandGuide/llvm-exegesis.rst
index c2681535b566..8266d891a5e6 100644
--- a/llvm/docs/CommandGuide/llvm-exegesis.rst
+++ b/llvm/docs/CommandGuide/llvm-exegesis.rst
@@ -473,6 +473,14 @@ OPTIONS
flag can be specified multiple times to measure multiple events. The maximum
number of validation counters is platform dependent.
+.. option:: --benchmark-process-cpu=<cpu id>
+
+ This option specifies the number of the CPU that should be used to run the
+ benchmarking subprocess. When starting the subprocess,
+ :program:`llvm-exegesis` will set the affinity of the subprocess to only
+ include the specified CPU. This option only works in the subprocess execution
+ mode.
+
EXIT STATUS
-----------
diff --git a/llvm/docs/CommandGuide/llvm-mc.rst b/llvm/docs/CommandGuide/llvm-mc.rst
index c5d2f9396dce..8d6346f4f1bc 100644
--- a/llvm/docs/CommandGuide/llvm-mc.rst
+++ b/llvm/docs/CommandGuide/llvm-mc.rst
@@ -92,6 +92,10 @@ End-user Options
Generate DWARF debugging info for assembly source files.
+.. option:: --hex
+
+ Take raw hexadecimal bytes as input for disassembly. Whitespace is ignored.
+
.. option:: --large-code-model
Create CFI directives that assume the code might be more than 2 GB.
diff --git a/llvm/docs/CommandGuide/llvm-objcopy.rst b/llvm/docs/CommandGuide/llvm-objcopy.rst
index e6af47ce9710..be4876cad676 100644
--- a/llvm/docs/CommandGuide/llvm-objcopy.rst
+++ b/llvm/docs/CommandGuide/llvm-objcopy.rst
@@ -78,10 +78,47 @@ multiple file formats.
Enable deterministic mode when copying archives, i.e. use 0 for archive member
header UIDs, GIDs and timestamp fields. On by default.
+.. option:: --globalize-symbol <symbol>
+
+ Mark any defined symbols named ``<symbol>`` as global symbols in the output.
+ Can be specified multiple times to mark multiple symbols.
+
+.. option:: --globalize-symbols <filename>
+
+ Read a list of names from the file ``<filename>`` and mark defined symbols with
+ those names as global in the output. In the file, each line represents a single
+ symbol, with leading and trailing whitespace ignored, as is anything following
+ a '#'. Can be specified multiple times to read names from multiple files.
+
.. option:: --help, -h
Print a summary of command line options.
+.. option:: --keep-global-symbol <symbol>, -G
+
+ Mark all symbols local in the output, except for symbols with the name
+ ``<symbol>``. Can be specified multiple times to ignore multiple symbols.
+
+.. option:: --keep-global-symbols <filename>
+
+ Mark all symbols local in the output, except for symbols named in the file
+ ``<filename>``. In the file, each line represents a single symbol, with leading
+ and trailing whitespace ignored, as is anything following a '#'. Can be
+ specified multiple times to read names from multiple files.
+
+.. option:: --localize-symbol <symbol>, -L
+
+ Mark any defined non-common symbol named ``<symbol>`` as a local symbol in the
+ output. Can be specified multiple times to mark multiple symbols as local.
+
+.. option:: --localize-symbols <filename>
+
+ Read a list of names from the file ``<filename>`` and mark defined non-common
+ symbols with those names as local in the output. In the file, each line
+ represents a single symbol, with leading and trailing whitespace ignored, as is
+ anything following a '#'. Can be specified multiple times to read names from
+ multiple files.
+
.. option:: --only-keep-debug
Produce a debug file as the output that only preserves contents of sections
@@ -177,6 +214,19 @@ multiple file formats.
flags.
- `share` = add the `IMAGE_SCN_MEM_SHARED` and `IMAGE_SCN_MEM_READ` flags.
+.. option:: --skip-symbol <symbol>
+
+ Do not change the parameters of symbol ``<symbol>`` when executing other
+ options that can change the symbol's name, binding or visibility.
+
+.. option:: --skip-symbols <filename>
+
+ Do not change the parameters of symbols named in the file ``<filename>`` when
+ executing other options that can change the symbol's name, binding or
+ visibility. In the file, each line represents a single symbol, with leading
+ and trailing whitespace ignored, as is anything following a '#'.
+ Can be specified multiple times to read names from multiple files.
+
.. option:: --strip-all-gnu
Remove all symbols, debug sections and relocations from the output. This option
@@ -355,18 +405,6 @@ them.
For binary outputs, fill the gaps between sections with ``<value>`` instead
of zero. The value must be an unsigned 8-bit integer.
-.. option:: --globalize-symbol <symbol>
-
- Mark any defined symbols named ``<symbol>`` as global symbols in the output.
- Can be specified multiple times to mark multiple symbols.
-
-.. option:: --globalize-symbols <filename>
-
- Read a list of names from the file ``<filename>`` and mark defined symbols with
- those names as global in the output. In the file, each line represents a single
- symbol, with leading and trailing whitespace ignored, as is anything following
- a '#'. Can be specified multiple times to read names from multiple files.
-
.. option:: --input-target <format>, -I
Read the input as the specified format. See `SUPPORTED FORMATS`_ for a list of
@@ -377,18 +415,6 @@ them.
Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.
-.. option:: --keep-global-symbol <symbol>, -G
-
- Mark all symbols local in the output, except for symbols with the name
- ``<symbol>``. Can be specified multiple times to ignore multiple symbols.
-
-.. option:: --keep-global-symbols <filename>
-
- Mark all symbols local in the output, except for symbols named in the file
- ``<filename>``. In the file, each line represents a single symbol, with leading
- and trailing whitespace ignored, as is anything following a '#'. Can be
- specified multiple times to read names from multiple files.
-
.. option:: --keep-section <section>
When removing sections from the output, do not remove sections named
@@ -410,19 +436,6 @@ them.
Mark all symbols with hidden or internal visibility local in the output.
-.. option:: --localize-symbol <symbol>, -L
-
- Mark any defined non-common symbol named ``<symbol>`` as a local symbol in the
- output. Can be specified multiple times to mark multiple symbols as local.
-
-.. option:: --localize-symbols <filename>
-
- Read a list of names from the file ``<filename>`` and mark defined non-common
- symbols with those names as local in the output. In the file, each line
- represents a single symbol, with leading and trailing whitespace ignored, as is
- anything following a '#'. Can be specified multiple times to read names from
- multiple files.
-
.. option:: --new-symbol-visibility <visibility>
Specify the visibility of the symbols automatically created when using binary
@@ -489,19 +502,6 @@ them.
Read a list of symbols from <filename> and change their visibility to the
specified value. Visibility values: default, internal, hidden, protected.
-.. option:: --skip-symbol <symbol>
-
- Do not change the parameters of symbol ``<symbol>`` when executing other
- options that can change the symbol's name, binding or visibility.
-
-.. option:: --skip-symbols <filename>
-
- Do not change the parameters of symbols named in the file ``<filename>`` when
- executing other options that can change the symbol's name, binding or
- visibility. In the file, each line represents a single symbol, with leading
- and trailing whitespace ignored, as is anything following a '#'.
- Can be specified multiple times to read names from multiple files.
-
.. option:: --split-dwo <dwo-file>
Equivalent to running :program:`llvm-objcopy` with :option:`--extract-dwo` and
diff --git a/llvm/docs/Contributing.rst b/llvm/docs/Contributing.rst
index 38c058118286..cf48c66dc0d0 100644
--- a/llvm/docs/Contributing.rst
+++ b/llvm/docs/Contributing.rst
@@ -118,12 +118,24 @@ For developers to commit changes from Git
-----------------------------------------
Once a patch is reviewed, you can select the "Squash and merge" button in the
-GitHub web interface. You might need to rebase your change before pushing
-it to the repo.
+GitHub web interface.
-LLVM currently has a linear-history policy, which means that merge commits are
-not allowed. The `llvm-project` repo on github is configured to reject pushes
-that include merges, so the `git rebase` step above is required.
+When pushing directly from the command-line to the ``main`` branch, you will need
+to rebase your change. LLVM has a linear-history policy, which means
+that merge commits are not allowed and the ``main`` branch is configured to reject
+pushes that include merges.
+
+GitHub will display a message that looks like this:
+
+.. code-block:: console
+
+ remote: Bypassed rule violations for refs/heads/main:
+ remote:
+ remote: - Required status check “buildkite/github-pull-requests” is expected.
+
+This can seem scary, but this is just an artifact of the GitHub setup: it is
+intended as a warning for people merging pull-requests with failing CI. We can't
+disable it for people pushing on the command-line.
Please ask for help if you're having trouble with your particular git workflow.
diff --git a/llvm/docs/Coroutines.rst b/llvm/docs/Coroutines.rst
index 92e138b6893b..60e32dc467d2 100644
--- a/llvm/docs/Coroutines.rst
+++ b/llvm/docs/Coroutines.rst
@@ -810,6 +810,28 @@ The LLVM IR for a coroutine using a Coroutine with a custom ABI looks like:
ret ptr %hdl
}
+Parameter Attributes
+====================
+Some parameter attributes, used to communicate additional information about the result or parameters of a function, require special handling.
+
+ByVal
+-----
+A ByVal parameter on an argument indicates that the pointee should be treated as being passed by value to the function.
+Prior to the coroutine transforms loads and stores to/from the pointer are generated where the value is needed.
+Consequently, a ByVal argument is treated much like an alloca.
+Space is allocated for it on the coroutine frame and the uses of the argument pointer are replaced with a pointer to the coroutine frame.
+
+Swift Error
+-----------
+Clang supports the swiftcall calling convention in many common targets, and a user could call a function that takes a swifterror argument from a C++ coroutine.
+The swifterror parameter attribute exists to model and optimize Swift error handling.
+A swifterror alloca or parameter can only be loaded, stored, or passed as a swifterror call argument, and a swifterror call argument can only be a direct reference to a swifterror alloca or parameter.
+These rules, not coincidentally, mean that you can always perfectly model the data flow in the alloca, and LLVM CodeGen actually has to do that in order to emit code.
+
+For coroutine lowering the default treatment of allocas breaks those rules — splitting will try to replace the alloca with an entry in the coro frame, which can lead to trying to pass that as a swifterror argument.
+To pass a swifterror argument in a split function, we need to still have the alloca around; but we also potentially need the coro frame slot, since useful data can (in theory) be stored in the swifterror alloca slot across suspensions in the presplit coroutine.
+When split a coroutine it is consequently necessary to keep both the frame slot as well as the alloca itself and then keep them in sync.
+
Intrinsics
==========
diff --git a/llvm/docs/DirectX/DXILResources.rst b/llvm/docs/DirectX/DXILResources.rst
index dcec9611d8aa..3971d3788b8a 100644
--- a/llvm/docs/DirectX/DXILResources.rst
+++ b/llvm/docs/DirectX/DXILResources.rst
@@ -154,7 +154,7 @@ We provide a few different ways to instantiate resources in the IR via the
type, returning an appropriate handle for the resource, and represent binding
information in the arguments to the intrinsic.
-The three operations we need are ``llvm.dx.handle.fromBinding``,
+The three operations we need are ``llvm.dx.resource.handlefrombinding``,
``llvm.dx.handle.fromHeap``, and ``llvm.dx.handle.fromPointer``. These are
rougly equivalent to the DXIL operations ``dx.op.createHandleFromBinding``,
``dx.op.createHandleFromHeap``, and ``dx.op.createHandleForLib``, but they fold
@@ -169,7 +169,7 @@ arguments.
.. _dx.op.createHandle: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#resource-handles
-.. list-table:: ``@llvm.dx.handle.fromBinding``
+.. list-table:: ``@llvm.dx.resource.handlefrombinding``
:header-rows: 1
* - Argument
@@ -210,35 +210,35 @@ Examples:
; RWBuffer<float4> Buf : register(u5, space3)
%buf = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0)
- @llvm.dx.handle.fromBinding.tdx.TypedBuffer_f32_1_0(
- i32 3, i32 5, i32 1, i32 0, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0(
+ i32 3, i32 5, i32 1, i32 0, i1 false)
; RWBuffer<int> Buf : register(u7, space2)
%buf = call target("dx.TypedBuffer", i32, 1, 0, 1)
- @llvm.dx.handle.fromBinding.tdx.TypedBuffer_i32_1_0t(
- i32 2, i32 7, i32 1, i32 0, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_i32_1_0t(
+ i32 2, i32 7, i32 1, i32 0, i1 false)
; Buffer<uint4> Buf[24] : register(t3, space5)
%buf = call target("dx.TypedBuffer", <4 x i32>, 0, 0, 0)
- @llvm.dx.handle.fromBinding.tdx.TypedBuffer_i32_0_0t(
- i32 2, i32 7, i32 24, i32 0, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_i32_0_0t(
+ i32 2, i32 7, i32 24, i32 0, i1 false)
; struct S { float4 a; uint4 b; };
; StructuredBuffer<S> Buf : register(t2, space4)
%buf = call target("dx.RawBuffer", {<4 x float>, <4 x i32>}, 0, 0)
- @llvm.dx.handle.fromBinding.tdx.RawBuffer_sl_v4f32v4i32s_0_0t(
- i32 4, i32 2, i32 1, i32 0, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_sl_v4f32v4i32s_0_0t(
+ i32 4, i32 2, i32 1, i32 0, i1 false)
; ByteAddressBuffer Buf : register(t8, space1)
%buf = call target("dx.RawBuffer", i8, 0, 0)
- @llvm.dx.handle.fromBinding.tdx.RawBuffer_i8_0_0t(
- i32 1, i32 8, i32 1, i32 0, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0t(
+ i32 1, i32 8, i32 1, i32 0, i1 false)
; RWBuffer<float4> Global[3] : register(u6, space5)
; RWBuffer<float4> Buf = Global[2];
%buf = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0)
- @llvm.dx.handle.fromBinding.tdx.TypedBuffer_f32_1_0(
- i32 5, i32 6, i32 3, i32 2, i1 false)
+ @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0(
+ i32 5, i32 6, i32 3, i32 2, i1 false)
.. list-table:: ``@llvm.dx.handle.fromHeap``
:header-rows: 1
@@ -291,10 +291,10 @@ containing 4 elements of the same type, and in the case of `ResRet` a 5th
element that is used by the `CheckAccessFullyMapped`_ operation.
In LLVM IR the intrinsics will return the contained type of the resource
-instead. That is, ``llvm.dx.typedBufferLoad`` from a ``Buffer<float>`` would
-return a single float, from ``Buffer<float4>`` a vector of 4 floats, and from
-``Buffer<double2>`` a vector of two doubles, etc. The operations are then
-expanded out to match DXIL's format during lowering.
+instead. That is, ``llvm.dx.resource.load.typedbuffer`` from a
+``Buffer<float>`` would return a single float, from ``Buffer<float4>`` a vector
+of 4 floats, and from ``Buffer<double2>`` a vector of two doubles, etc. The
+operations are then expanded out to match DXIL's format during lowering.
In cases where we need ``CheckAccessFullyMapped``, we have a second intrinsic
that returns an anonymous struct with element-0 being the contained type, and
@@ -308,7 +308,7 @@ HLSL source, but this actually matches DXC's behaviour in practice.
.. _CBufRet: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#cbufferloadlegacy
.. _CheckAccessFullyMapped: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/checkaccessfullymapped
-.. list-table:: ``@llvm.dx.typedBufferLoad``
+.. list-table:: ``@llvm.dx.resource.load.typedbuffer``
:header-rows: 1
* - Argument
@@ -333,22 +333,22 @@ Examples:
.. code-block:: llvm
%ret = call <4 x float>
- @llvm.dx.typedBufferLoad.v4f32.tdx.TypedBuffer_v4f32_0_0_0t(
+ @llvm.dx.resource.load.typedbuffer.v4f32.tdx.TypedBuffer_v4f32_0_0_0t(
target("dx.TypedBuffer", <4 x float>, 0, 0, 0) %buffer, i32 %index)
%ret = call float
- @llvm.dx.typedBufferLoad.f32.tdx.TypedBuffer_f32_0_0_0t(
+ @llvm.dx.resource.load.typedbuffer.f32.tdx.TypedBuffer_f32_0_0_0t(
target("dx.TypedBuffer", float, 0, 0, 0) %buffer, i32 %index)
%ret = call <4 x i32>
- @llvm.dx.typedBufferLoad.v4i32.tdx.TypedBuffer_v4i32_0_0_0t(
+ @llvm.dx.resource.load.typedbuffer.v4i32.tdx.TypedBuffer_v4i32_0_0_0t(
target("dx.TypedBuffer", <4 x i32>, 0, 0, 0) %buffer, i32 %index)
%ret = call <4 x half>
- @llvm.dx.typedBufferLoad.v4f16.tdx.TypedBuffer_v4f16_0_0_0t(
+ @llvm.dx.resource.load.typedbuffer.v4f16.tdx.TypedBuffer_v4f16_0_0_0t(
target("dx.TypedBuffer", <4 x half>, 0, 0, 0) %buffer, i32 %index)
%ret = call <2 x double>
- @llvm.dx.typedBufferLoad.v2f64.tdx.TypedBuffer_v2f64_0_0t(
+ @llvm.dx.resource.load.typedbuffer.v2f64.tdx.TypedBuffer_v2f64_0_0t(
target("dx.TypedBuffer", <2 x double>, 0, 0, 0) %buffer, i32 %index)
-.. list-table:: ``@llvm.dx.typedBufferLoad.checkbit``
+.. list-table:: ``@llvm.dx.resource.loadchecked.typedbuffer``
:header-rows: 1
* - Argument
@@ -371,7 +371,7 @@ Examples:
.. code-block:: llvm
%ret = call {<4 x float>, i1}
- @llvm.dx.typedBufferLoad.checkbit.v4f32.tdx.TypedBuffer_v4f32_0_0_0t(
+ @llvm.dx.resource.loadchecked.typedbuffer.v4f32.tdx.TypedBuffer_v4f32_0_0_0t(
target("dx.TypedBuffer", <4 x float>, 0, 0, 0) %buffer, i32 %index)
Texture and Typed Buffer Stores
@@ -397,7 +397,7 @@ types that are 32-bits or fewer, such as ``<4 x i32>``, ``<4 x float>``, and
Examples:
-.. list-table:: ``@llvm.dx.typedBufferStore``
+.. list-table:: ``@llvm.dx.resource.store.typedbuffer``
:header-rows: 1
* - Argument
@@ -425,9 +425,9 @@ Examples:
.. code-block:: llvm
- call void @llvm.dx.typedBufferStore.tdx.Buffer_v4f32_1_0_0t(
+ call void @llvm.dx.resource.store.typedbuffer.tdx.Buffer_v4f32_1_0_0t(
target("dx.TypedBuffer", f32, 1, 0) %buf, i32 %index, <4 x f32> %data)
- call void @llvm.dx.typedBufferStore.tdx.Buffer_v4f16_1_0_0t(
+ call void @llvm.dx.resource.store.typedbuffer.tdx.Buffer_v4f16_1_0_0t(
target("dx.TypedBuffer", f16, 1, 0) %buf, i32 %index, <4 x f16> %data)
- call void @llvm.dx.typedBufferStore.tdx.Buffer_v2f64_1_0_0t(
+ call void @llvm.dx.resource.store.typedbuffer.tdx.Buffer_v2f64_1_0_0t(
target("dx.TypedBuffer", f64, 1, 0) %buf, i32 %index, <2 x f64> %data)
diff --git a/llvm/docs/ExceptionHandling.rst b/llvm/docs/ExceptionHandling.rst
index c2afb25c6ccd..bb72e5a71a77 100644
--- a/llvm/docs/ExceptionHandling.rst
+++ b/llvm/docs/ExceptionHandling.rst
@@ -374,10 +374,12 @@ overall functioning of this intrinsic is compatible with the GCC
to interoperate.
The single parameter is a pointer to a five word buffer in which the calling
-context is saved. The front end places the frame pointer in the first word, and
-the target implementation of this intrinsic should place the destination address
-for a `llvm.eh.sjlj.longjmp`_ in the second word. The following three words are
-available for use in a target-specific manner.
+context is saved. The format and contents of the buffer are target-specific.
+On certain targets (ARM, PowerPC, VE, X86), the front end places the
+frame pointer in the first word and the stack pointer in the third word,
+while the target implementation of this intrinsic fills in the remaining
+words. On other targets (SystemZ), saving the calling context to the buffer
+is left completely to the target implementation.
.. _llvm.eh.sjlj.longjmp:
diff --git a/llvm/docs/GettingInvolved.rst b/llvm/docs/GettingInvolved.rst
index 1f4f5d577efd..edb3b5d9c2ad 100644
--- a/llvm/docs/GettingInvolved.rst
+++ b/llvm/docs/GettingInvolved.rst
@@ -311,11 +311,6 @@ The :doc:`CodeOfConduct` applies to all office hours.
- Monthly, last Monday of the month at 18:00 London time (typically 9am PT), for 30 minutes.
- `Video Call <https://meet.grosser.science/LLVMOfficeHours>`__
- English, German, Spanish, French
- * - Anastasia Stulova
- - Clang internals for C/C++ language extensions and dialects, OpenCL, GPU, SPIR-V, how to contribute, women in compilers.
- - Monthly, 1st Tuesday of the month at 17:00 BST - London time (9:00am PT except for 2 weeks in spring), 30 mins slot.
- - `GoogleMeet <https://meet.google.com/kdy-fdbv-nuk>`__
- - English, Russian, German (not fluently)
* - Alexey Bader
- SYCL compiler, offload tools, OpenCL and SPIR-V, how to contribute.
- Monthly, 2nd Monday of the month at 9:30am PT, for 30 minutes.
diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst
index 8ef1f85d6b6f..7f4b62f63957 100644
--- a/llvm/docs/GettingStarted.rst
+++ b/llvm/docs/GettingStarted.rst
@@ -356,7 +356,7 @@ popular host toolchains for specific minimum versions in our build systems:
* Clang 5.0
* Apple Clang 10.0
* GCC 7.4
-* Visual Studio 2019 16.7
+* Visual Studio 2019 16.8
Anything older than these toolchains *may* work, but will require forcing the
build system with a special option and is not really a supported host platform.
diff --git a/llvm/docs/GitHub.rst b/llvm/docs/GitHub.rst
index 37995969b6df..85766bfe94af 100644
--- a/llvm/docs/GitHub.rst
+++ b/llvm/docs/GitHub.rst
@@ -215,6 +215,28 @@ commonly used first:
this result correctly with a note that a force push did occur.
+Pre-merge Continuous Integration (CI)
+-------------------------------------
+
+Multiple checks will be applied on a pull-request, either for linting/formatting
+or some build and tests. None of these are perfect and you will encounter
+false positive, infrastructure failures (unstable or unavailable worker), or
+you will be unlucky and based your change on a broken revision of the main branch.
+
+None of the checks are strictly mandatory: these are tools to help us build a
+better codebase and be more productive (by avoiding issues found post-merge and
+possible reverts). As a developer you're empowered to exercise your judgement
+about bypassing any of the checks when merging code.
+
+The infrastructure can print messages that make it seem like these are mandatory,
+but this is just an artifact of GitHub infrastructure and not a policy of the
+project.
+
+However, please make sure you do not force-merge any changes that have clear
+test failures directly linked to your changes. Our policy is still to keep the
+``main`` branch in a good condition, and introducing failures to be fixed later
+violates that policy.
+
Problems After Landing Your Change
==================================
diff --git a/llvm/docs/GlobalISel/GenericOpcode.rst b/llvm/docs/GlobalISel/GenericOpcode.rst
index 718f99373d28..8b76a407c34f 100644
--- a/llvm/docs/GlobalISel/GenericOpcode.rst
+++ b/llvm/docs/GlobalISel/GenericOpcode.rst
@@ -474,6 +474,9 @@ undefined.
%2:_(s33) = G_CTLZ_ZERO_UNDEF %1
%2:_(s33) = G_CTTZ_ZERO_UNDEF %1
+G_ABDS, G_ABDU
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
Compute the absolute difference (signed and unsigned), e.g. abs(x-y).
.. code-block:: none
@@ -1131,3 +1134,6 @@ G_CONSTANT_FOLD_BARRIER
This operation is used as an opaque barrier to prevent constant folding. Combines
and other transformations should not look through this. These have no other
semantics and can be safely eliminated if a target chooses.
+
+
+Unlisted: G_STACKSAVE, G_STACKRESTORE, G_FSHL, G_FSHR, G_SMULFIX, G_UMULFIX, G_SMULFIXSAT, G_UMULFIXSAT, G_SDIVFIX, G_UDIVFIX, G_SDIVFIXSAT, G_UDIVFIXSAT, G_FPOWI, G_FEXP10, G_FLDEXP, G_FFREXP, G_GET_FPENV, G_SET_FPENV, G_RESET_FPENV, G_GET_FPMODE, G_SET_FPMODE, G_RESET_FPMODE, G_INTRINSIC_FPTRUNC_ROUND, G_INTRINSIC_LRINT, G_INTRINSIC_LLRINT, G_INTRINSIC_ROUNDEVEN, G_READCYCLECOUNTER, G_READSTEADYCOUNTER, G_PREFETCH, G_READ_REGISTER, G_WRITE_REGISTER, G_STRICT_FADD, G_STRICT_FSUB, G_STRICT_FMUL, G_STRICT_FDIV, G_STRICT_FREM, G_STRICT_FMA, G_STRICT_FSQRT, G_STRICT_FLDEXP, G_ASSERT_ALIGN
diff --git a/llvm/docs/GlobalISel/Legalizer.rst b/llvm/docs/GlobalISel/Legalizer.rst
index 1ff7b304b3a0..0e256ac7781c 100644
--- a/llvm/docs/GlobalISel/Legalizer.rst
+++ b/llvm/docs/GlobalISel/Legalizer.rst
@@ -338,8 +338,8 @@ G_BUILD_VECTOR_TRUNC, G_CONCAT_VECTORS, G_UNMERGE_VALUES, G_PTRTOINT, and
G_INTTOPTR have already been noted above. In addition to those, the following
operations have requirements:
-* At least one G_IMPLICIT_DEF must be legal. This is usually trivial as it
- requires no code to be selected.
+* For every type that can be produced by any instruction, G_IMPLICIT_DEF must be
+ legal.
* G_PHI must be legal for all types in the producer and consumer typesets. This
is usually trivial as it requires no code to be selected.
* At least one G_FRAME_INDEX must be legal
diff --git a/llvm/docs/MemTagSanitizer.rst b/llvm/docs/MemTagSanitizer.rst
index 62efbfb041cb..8a0fffc0d382 100644
--- a/llvm/docs/MemTagSanitizer.rst
+++ b/llvm/docs/MemTagSanitizer.rst
@@ -28,10 +28,15 @@ memory bugs.
Usage
=====
-Compile and link your program with ``-fsanitize=memtag`` flag. This
-will only work when targeting AArch64 with MemTag extension. One
-possible way to achieve that is to add ``-target
-aarch64-linux -march=armv8+memtag`` to compilation flags.
+Compile and link your program with the ``-fsanitize=memtag`` flag. This
+will only work when targeting AArch64 Android with the memory tagging extension.
+One possible way to achieve that is to add ``--target=aarch64-linux-android -march=armv8+memtag``
+to your compilation flags.
+
+Note that doing this will override existing flags of the same type. Assuming that
+you are already targeting AArch64 Android, an alternative is to add
+``-Xclang -target-feature -Xclang +mte`` to your compilation flags. This
+adds the memory tagging feature, without changing anything else.
Implementation
==============
diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst
index b19632535b3e..313e84f3722a 100644
--- a/llvm/docs/NVPTXUsage.rst
+++ b/llvm/docs/NVPTXUsage.rst
@@ -733,6 +733,96 @@ these intrinsics is a boolean flag, with the same functionality as described in
For more information, refer PTX ISA
`<https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-cp-reduce-async-bulk-tensor>`_.
+Warp Group Intrinsics
+---------------------
+
+'``llvm.nvvm.wgmma.fence.sync.aligned``'
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+.. code-block:: llvm
+
+ declare void @llvm.nvvm.wgmma.fence.sync.aligned()
+
+Overview:
+"""""""""
+
+The '``@llvm.nvvm.wgmma.fence.sync.aligned``' intrinsic generates the
+``wgmma.fence.sync.aligned`` PTX instruction, which establishes an ordering
+between prior accesses to any warpgroup registers and subsequent accesses to
+the same registers by a ``wgmma.mma_async`` instruction.
+
+The ``wgmma.fence`` instruction must be issued by all warps of the warpgroup in
+the following locations:
+
+* Before the first ``wgmma.mma_async`` operation in a warpgroup.
+* Between a register access by a thread in the warpgroup and any
+ ``wgmma.mma_async`` instruction that accesses the same registers, except when
+ these are accumulator register accesses across multiple ``wgmma.mma_async``
+ instructions of the same shape in which case an ordering guarantee is
+ provided by default.
+
+For more information, refer PTX ISA
+`<https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-fence>`_.
+
+'``llvm.nvvm.wgmma.commit_group.sync.aligned``'
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+.. code-block:: llvm
+
+ declare void @llvm.nvvm.wgmma.commit_group.sync.aligned()
+
+Overview:
+"""""""""
+
+The '``@llvm.nvvm.wgmma.commit_group.sync.aligned``' intrinsic generates the
+``wgmma.commit_group.sync.aligned`` PTX instruction, which creates a new
+wgmma-group per warpgroup and batches all prior ``wgmma.mma_async``
+instructions initiated by the executing warp but not committed to any
+wgmma-group into the new wgmma-group. If there are no uncommitted ``wgmma
+mma_async`` instructions then, ``wgmma.commit_group`` results in an empty
+wgmma-group.
+
+An executing thread can wait for the completion of all ``wgmma.mma_async``
+operations in a wgmma-group by using ``wgmma.wait_group``.
+
+For more information, refer PTX ISA
+`<https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-commit-group>`_.
+
+'``llvm.nvvm.wgmma.wait_group.sync.aligned``'
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+.. code-block:: llvm
+
+ declare void @llvm.nvvm.wgmma.wait_group.sync.aligned(i64 immarg N)
+
+Overview:
+"""""""""
+
+The '``@llvm.nvvm.wgmma.wait_group.sync.aligned``' intrinsic generates the
+``wgmma.commit_group.sync.aligned N`` PTX instruction, which will cause the
+executing thread to wait until only ``N`` or fewer of the most recent
+wgmma-groups are pending and all the prior wgmma-groups committed by the
+executing threads are complete. For example, when ``N`` is 0, the executing
+thread waits on all the prior wgmma-groups to complete. Operand ``N`` is an
+integer constant.
+
+Accessing the accumulator register or the input register containing the
+fragments of matrix A of a ``wgmma.mma_async`` instruction without first
+performing a ``wgmma.wait_group`` instruction that waits on a wgmma-group
+including that ``wgmma.mma_async`` instruction is undefined behavior.
+
+For more information, refer PTX ISA
+`<https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-wait-group>`_.
+
Other Intrinsics
----------------
diff --git a/llvm/docs/RISCV/RISCVVectorExtension.rst b/llvm/docs/RISCV/RISCVVectorExtension.rst
index 39836a4b1ab9..a3adb8bb0a73 100644
--- a/llvm/docs/RISCV/RISCVVectorExtension.rst
+++ b/llvm/docs/RISCV/RISCVVectorExtension.rst
@@ -233,6 +233,9 @@ For scalable vectors that should use VLMAX, the AVL is set to a sentinel value o
There are patterns for target agnostic SelectionDAG nodes in ``RISCVInstrInfoVSDPatterns.td``, VL nodes in ``RISCVInstrInfoVVLPatterns.td`` and RVV intrinsics in ``RISCVInstrInfoVPseudos.td``.
+Instructions that operate only on masks like VMAND or VMSBF uses pseudo instructions suffixed with B1, B2, B4, B8, B16, B32, or B64 where the number is SEW/LMUL representing
+the ratio between SEW and LMUL needed in vtype. These instructions always operate as if EEW=1 and always use a value of 0 as their SEW operand.
+
Mask patterns
-------------
diff --git a/llvm/docs/RISCVUsage.rst b/llvm/docs/RISCVUsage.rst
index 3978332b1149..eaaad6c51681 100644
--- a/llvm/docs/RISCVUsage.rst
+++ b/llvm/docs/RISCVUsage.rst
@@ -429,9 +429,21 @@ The current vendor extensions supported are:
``experimental-Xqcia``
LLVM implements `version 0.2 of the Qualcomm uC Arithmetic extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+``experimental-Xqciac``
+ LLVM implements `version 0.2 of the Qualcomm uC Load-Store Address Calculation extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+
+``experimental-Xqcicli``
+ LLVM implements `version 0.2 of the Qualcomm uC Conditional Load Immediate extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+
+``experimental-Xqcics``
+ LLVM implements `version 0.2 of the Qualcomm uC Conditional Select extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+
``experimental-Xqcicsr``
LLVM implements `version 0.2 of the Qualcomm uC CSR extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+``experimental-Xqcilsm``
+ LLVM implements `version 0.2 of the Qualcomm uC Load Store Multiple extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
+
``experimental-Xqcisls``
LLVM implements `version 0.2 of the Qualcomm uC Scaled Load Store extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.
diff --git a/llvm/docs/Reference.rst b/llvm/docs/Reference.rst
index df61628b06c7..2cae9186d7f9 100644
--- a/llvm/docs/Reference.rst
+++ b/llvm/docs/Reference.rst
@@ -52,6 +52,7 @@ LLVM and API reference documentation.
TestingGuide
TransformMetadata
TypeMetadata
+ UndefinedBehavior
XRay
XRayExample
XRayFDRFormat
@@ -120,6 +121,9 @@ LLVM IR
Defines the LLVM intermediate representation and the assembly form of the
different nodes.
+:doc:`Undefined Behavior (UB) <UndefinedBehavior>`
+ A guide on what UB/undef/poison are and when to use each one.
+
:doc:`InAlloca`
Description of the ``inalloca`` argument attribute.
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 4204ebba4750..be62a7e8696b 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -113,6 +113,8 @@ Changes to LLVM infrastructure
Changes to building LLVM
------------------------
+* Raised the minimum MSVC version to Visual Studio 2019 16.8.
+
Changes to TableGen
-------------------
@@ -129,6 +131,8 @@ Changes to the AArch64 Backend
* Assembler/disassembler support has been added for Armv9.6-A (2024)
architecture extensions.
+* Added support for the FUJITSU-MONAKA CPU.
+
Changes to the AMDGPU Backend
-----------------------------
@@ -193,6 +197,7 @@ Changes to the RISC-V Backend
* Added `Smctr`, `Ssctr` and `Svvptc` extensions.
* `-mcpu=syntacore-scr7` was added.
* `-mcpu=tt-ascalon-d8` was added.
+* `-mcpu=mips-p8700` was added.
* The `Zacas` extension is no longer marked as experimental.
* Added Smdbltrp, Ssdbltrp extensions to -march.
* The `Smmpm`, `Smnpm`, `Ssnpm`, `Supm`, and `Sspm` pointer masking extensions
@@ -219,6 +224,14 @@ Changes to the RISC-V Backend
extension.
* Adds experimental assembler support for the Qualcomm uC 'Xqcia` (Arithmetic)
extension.
+* Adds experimental assembler support for the Qualcomm uC 'Xqciac` (Load-Store Address Calculation)
+ extension.
+* Adds experimental assembler support for the Qualcomm uC 'Xqcics` (Conditonal Select)
+ extension.
+* Adds experimental assembler support for the Qualcomm uC 'Xqcilsm` (Load Store Multiple)
+ extension.
+* Adds experimental assembler support for the Qualcomm uC 'Xqcicli` (Conditional Load Immediate)
+ extension.
Changes to the WebAssembly Backend
----------------------------------
@@ -267,6 +280,13 @@ Changes to the X86 Backend
* Supported ``-mcpu=diamondrapids``
+* Supported emitting relocation types for x86-64 target:
+ * `R_X86_64_CODE_4_GOTPCRELX`
+ * `R_X86_64_CODE_4_GOTTPOFF`
+ * `R_X86_64_CODE_4_GOTPC32_TLSDESC`
+ * `R_X86_64_CODE_6_GOTTPOFF`
+
+
Changes to the OCaml bindings
-----------------------------
@@ -336,10 +356,16 @@ Changes to the Debug Info
Changes to the LLVM tools
---------------------------------
+* llvm-objcopy now supports the following options for Mach-O:
+ `--globalize-symbol`, `--globalize-symbols`,
+ `--keep-global-symbol`, `--keep-global-symbols`,
+ `--localize-symbol`, `--localize-symbols`,
+ `--skip-symbol`, `--skip-symbols`.
+
Changes to LLDB
---------------------------------
-* LLDB now now supports inline diagnostics for the expression evaluator and command line parser.
+* LLDB now supports inline diagnostics for the expression evaluator and command line parser.
Old:
```
diff --git a/llvm/docs/SPIRVUsage.rst b/llvm/docs/SPIRVUsage.rst
index 8f7ac71f8026..23c5fe37a9b8 100644
--- a/llvm/docs/SPIRVUsage.rst
+++ b/llvm/docs/SPIRVUsage.rst
@@ -159,6 +159,8 @@ list of supported SPIR-V extensions, sorted alphabetically by their extension na
- Adds instructions to convert between single-precision 32-bit floating-point values and 16-bit bfloat16 values.
* - ``SPV_INTEL_cache_controls``
- Allows cache control information to be applied to memory access instructions.
+ * - ``SPV_INTEL_float_controls2``
+ - Adds execution modes and decorations to control floating-point computations.
* - ``SPV_INTEL_function_pointers``
- Allows translation of function pointers.
* - ``SPV_INTEL_inline_assembly``
@@ -393,7 +395,7 @@ SPIR-V backend, along with their descriptions and argument details.
- Pointer
- `[8-bit Integer]`
- Creates a resource handle for graphics or compute resources. Facilitates the management and use of resources in shaders.
- * - `int_spv_handle_fromBinding`
+ * - `int_spv_resource_handlefrombinding`
- spirv.Image
- `[32-bit Integer set, 32-bit Integer binding, 32-bit Integer arraySize, 32-bit Integer index, bool isUniformIndex]`
- Returns the handle for the resource at the given set and binding.\
@@ -408,7 +410,7 @@ SPIR-V backend, along with their descriptions and argument details.
return type is a scalar, then the first element of the vector is \
returned. If the return type is an n-element vector, then the first \
n-elements of the 4-element vector are returned.
- * - `int_spv_typedBufferStore`
+ * - `int_spv_resource_store_typedbuffer`
- void
- `[spirv.Image Image, 32-bit Integer coordinate, vec4 data]`
- Stores the data to the image buffer at the given coordinate. The \
diff --git a/llvm/docs/Security.rst b/llvm/docs/Security.rst
index 67b6ebb4b04d..cd7b6478c572 100644
--- a/llvm/docs/Security.rst
+++ b/llvm/docs/Security.rst
@@ -1,19 +1,18 @@
-===================
-LLVM Security Group
-===================
+============================
+LLVM Security Response Group
+============================
-The LLVM Security Group has the following goals:
+The LLVM Security Response Group has the following goals:
1. Allow LLVM contributors and security researchers to disclose security-related issues affecting the LLVM project to members of the LLVM community.
2. Organize fixes, code reviews, and release management for said issues.
3. Allow distributors time to investigate and deploy fixes before wide dissemination of vulnerabilities or mitigation shortcomings.
4. Ensure timely notification and release to vendors who package and distribute LLVM-based toolchains and projects.
5. Ensure timely notification to users of LLVM-based toolchains whose compiled code is security-sensitive, through the `CVE process`_.
-6. Strive to improve security over time, for example by adding additional testing, fuzzing, and hardening after fixing issues.
*Note*: these goals ensure timely action, provide disclosure timing when issues are reported, and respect vendors' / packagers' / users' constraints.
-The LLVM Security Group is private. It is composed of trusted LLVM contributors. Its discussions remain within the Security Group (plus issue reporter and key experts) while an issue is being investigated. After an issue becomes public, the entirety of the group’s discussions pertaining to that issue also become public.
+The LLVM Security Response Group is private. It is composed of trusted LLVM contributors. Its discussions remain within the LLVM Security Response Group (plus issue reporter and key experts) while an issue is being investigated. After an issue becomes public, the entirety of the group’s discussions pertaining to that issue also become public.
.. _report-security-issue:
@@ -22,20 +21,21 @@ How to report a security issue?
To report a security issue in any of the LLVM projects, please use the `report a vulnerability`_ feature in the `llvm/llvm-security-repo`_ repository on github, under the "Security" tab.
-We aim to acknowledge your report within two business days since you first reach out. If you do not receive any response by then, you can escalate by posting on the `Discourse forums`_ asking to get in touch with someone from the LLVM Security Group. **The escalation mailing list is public**: avoid discussing or mentioning the specific issue when posting on it.
+We aim to acknowledge your report within two business days since you first reach out. If you do not receive any response by then, you can escalate by posting on the `Discourse forums`_ asking to get in touch with someone from the LLVM Security Response Group. **The escalation mailing list is public**: avoid discussing or mentioning the specific issue when posting on it.
Group Composition
=================
-Security Group Members
-----------------------
+Security Response Group Members
+-------------------------------
The members of the group represent a wide cross-section of the community, and
meet the criteria for inclusion below. The list is in the format
`* ${full_name} (${affiliation}) [${github_username}]`. If a github
username for an individual isn't available, the brackets will be empty.
+* Abhay Kanhere (Apple) [@AbhayKanhere]
* Ahmed Bougacha (Apple) [@ahmedbougacha]
* Artur Pilipenko (Azul Systems Inc) []
* Boovaragavan Dasarathan (Nvidia) [@mrragava]
@@ -61,7 +61,7 @@ username for an individual isn't available, the brackets will be empty.
Criteria
--------
-* Nominees for LLVM Security Group membership should fall in one of these groups:
+* Nominees for LLVM Security Response Group membership should fall in one of these groups:
- Individual contributors:
@@ -79,75 +79,75 @@ Criteria
+ Represents an organization or company which ships products that include their own copy of LLVM. Due to their position in the organization, the nominee has a reasonable need to know about security issues and disclosure embargoes.
-* Additionally, the following are necessary but not sufficient criteria for membership in the LLVM Security Group:
+* Additionally, the following are necessary but not sufficient criteria for membership in the LLVM Security Response Group:
- - If already in the LLVM Security Group, has actively participated in one (if any) security issue in the last year.
- - If already in the LLVM Security Group, has actively participated in most membership discussions in the last year.
- - If already in the LLVM Security Group, has actively participated in writing or reviewing a transparency report in the last year.
- - When employed by a company or other entity, the parent entity has no more than three members already in the LLVM Security Group.
+ - If already in the LLVM Security Response Group, has actively participated in one (if any) security issue in the last year.
+ - If already in the LLVM Security Response Group, has actively participated in most membership discussions in the last year.
+ - If already in the LLVM Security Response Group, has actively participated in writing or reviewing a transparency report in the last year.
+ - When employed by a company or other entity, the parent entity has no more than three members already in the LLVM Security Response Group.
- When nominated as a vendor contact, their position with that vendor remains the same as when originally nominated.
- - Nominees are trusted by existing Security Group members to keep communications embargoed while still active.
+ - Nominees are trusted by existing LLVM Security Response Group members to keep communications embargoed while still active.
Nomination process
------------------
-Anyone who feels they meet these criteria can nominate themselves, or may be nominated by a third party such as an existing LLVM Security Group member. The nomination should state whether the nominee is nominated as an individual, researcher, or as a vendor contact. It should clearly describe the grounds for nomination.
+Anyone who feels they meet these criteria can nominate themselves, or may be nominated by a third party such as an existing LLVM Security Response Group member. The nomination should state whether the nominee is nominated as an individual, researcher, or as a vendor contact. It should clearly describe the grounds for nomination.
-For the moment, nominations are generally proposed, discussed, and voted on using a github pull request. An `example nomination is available here`_. The use of pull requests helps keep membership discussions open, transparent, and easily accessible to LLVM developers in many ways. If, for any reason, a fully-world-readable nomination seems inappropriate, you may reach out to the security group via the `report a vulnerability`_ route, and a discussion can be had about the best way to approach nomination, given the constraints that individuals are under.
+For the moment, nominations are generally proposed, discussed, and voted on using a github pull request. An `example nomination is available here`_. The use of pull requests helps keep membership discussions open, transparent, and easily accessible to LLVM developers in many ways. If, for any reason, a fully-world-readable nomination seems inappropriate, you may reach out to the LLVM Security Response Group via the `report a vulnerability`_ route, and a discussion can be had about the best way to approach nomination, given the constraints that individuals are under.
Choosing new members
--------------------
-If a nomination for LLVM Security Group membership is supported by a majority of existing LLVM Security Group members, then it carries within five business days unless an existing member of the Security Group objects. If an objection is raised, the LLVM Security Group members should discuss the matter and try to come to consensus; failing this, the nomination will succeed only by a two-thirds supermajority vote of the LLVM Security Group.
+If a nomination for LLVM Security Response Group membership is supported by a majority of existing LLVM Security Response Group members, then it carries within five business days unless an existing member of the Security Response Group objects. If an objection is raised, the LLVM Security Response Group members should discuss the matter and try to come to consensus; failing this, the nomination will succeed only by a two-thirds supermajority vote of the LLVM Security Response Group.
Accepting membership
--------------------
-Before new LLVM Security Group membership is finalized, the successful nominee should accept membership and agree to abide by this security policy, particularly `Privileges and Responsibilities of LLVM Security Group Members`_ below.
+Before new LLVM Security Response Group membership is finalized, the successful nominee should accept membership and agree to abide by this security policy, particularly `Privileges and Responsibilities of LLVM Security Response Group Members`_ below.
Keeping Membership Current
--------------------------
-* At least every six months, the LLVM Security Group applies the above criteria. The membership list is pruned accordingly.
-* Any Security Group member can ask that the criteria be applied within the next five business days.
-* If a member of the LLVM Security Group does not act in accordance with the letter and spirit of this policy, then their LLVM Security Group membership can be revoked by a majority vote of the members, not including the person under consideration for revocation. After a member calls for a revocation vote, voting will be open for five business days.
-* Emergency suspension: an LLVM Security Group member who blatantly disregards the LLVM Security Policy may have their membership temporarily suspended on the request of any two members. In such a case, the requesting members should notify the Security Group with a description of the offense. At this point, membership will be temporarily suspended for five business days, pending outcome of the vote for permanent revocation.
-* The LLVM Board may remove any member from the LLVM Security Group.
+* At least every six months, the LLVM Security Response Group applies the above criteria. The membership list is pruned accordingly.
+* Any LLVM Security Response Group member can ask that the criteria be applied within the next five business days.
+* If a member of the LLVM Security Response Group does not act in accordance with the letter and spirit of this policy, then their LLVM Security Response Group membership can be revoked by a majority vote of the members, not including the person under consideration for revocation. After a member calls for a revocation vote, voting will be open for five business days.
+* Emergency suspension: an LLVM Security Response Group member who blatantly disregards the LLVM Security Policy may have their membership temporarily suspended on the request of any two members. In such a case, the requesting members should notify the LLVM Security Response Group with a description of the offense. At this point, membership will be temporarily suspended for five business days, pending outcome of the vote for permanent revocation.
+* The LLVM Board may remove any member from the LLVM Security Response Group.
Transparency Report
-------------------
-Every year, the LLVM Security Group must publish a transparency report. The intent of this report is to keep the community informed by summarizing the disclosures that have been made public in the last year. It shall contain a list of all public disclosures, as well as statistics on time to fix issues, length of embargo periods, and so on.
+Every year, the LLVM Security Response Group must publish a transparency report. The intent of this report is to keep the community informed by summarizing the disclosures that have been made public in the last year. It shall contain a list of all public disclosures, as well as statistics on time to fix issues, length of embargo periods, and so on.
The transparency reports are published at :doc:`SecurityTransparencyReports`.
-Privileges and Responsibilities of LLVM Security Group Members
-==============================================================
+Privileges and Responsibilities of LLVM Security Response Group Members
+=======================================================================
Access
------
-LLVM Security Group members will be subscribed to a private `Discussion Medium`_. It will be used for technical discussions of security issues, as well as process discussions about matters such as disclosure timelines and group membership. Members have access to all security issues.
+LLVM Security Response Group members will be subscribed to a private `Discussion Medium`_. It will be used for technical discussions of security issues, as well as process discussions about matters such as disclosure timelines and group membership. Members have access to all security issues.
Confidentiality
---------------
-Members of the LLVM Security Group will be expected to treat LLVM security issue information shared with the group as confidential until publicly disclosed:
+Members of the LLVM Security Response Group will be expected to treat LLVM security issue information shared with the group as confidential until publicly disclosed:
* Members should not disclose security issue information to non-members unless both members are employed by the same vendor of a LLVM based product, in which case information can be shared within that organization on a need-to-know basis and handled as confidential information normally is within that organization.
-* If the LLVM Security Group agrees, designated members may share issues with vendors of non-LLVM based products if their product suffers from the same issue. The non-LLVM vendor should be asked to respect the issue’s embargo date, and to not share the information beyond the need-to-know people within their organization.
-* If the LLVM Security Group agrees, key experts can be brought in to help address particular issues. The key expert should be asked to respect the issue’s embargo date, and to not share the information.
+* If the LLVM Security Response Group agrees, designated members may share issues with vendors of non-LLVM based products if their product suffers from the same issue. The non-LLVM vendor should be asked to respect the issue’s embargo date, and to not share the information beyond the need-to-know people within their organization.
+* If the LLVM Security Response Group agrees, key experts can be brought in to help address particular issues. The key expert should be asked to respect the issue’s embargo date, and to not share the information.
Disclosure
----------
-Following the process below, the LLVM Security Group decides on embargo date for public disclosure for each Security issue. An embargo may be lifted before the agreed-upon date if all vendors planning to ship a fix have already done so, and if the reporter does not object.
+Following the process below, the LLVM Security Response Group decides on embargo date for public disclosure for each Security issue. An embargo may be lifted before the agreed-upon date if all vendors planning to ship a fix have already done so, and if the reporter does not object.
Collaboration
-------------
-Members of the LLVM Security Group are expected to:
+Members of the LLVM Security Response Group are expected to:
* Promptly share any LLVM vulnerabilities they become aware of.
* Volunteer to drive issues forward.
@@ -159,14 +159,14 @@ Members of the LLVM Security Group are expected to:
Discussion Medium
=================
-The medium used to host LLVM Security Group discussions is security-sensitive. It should therefore run on infrastructure which can meet our security expectations.
+The medium used to host LLVM Security Response Group discussions is security-sensitive. It should therefore run on infrastructure which can meet our security expectations.
We use `GitHub's mechanism to privately report security vulnerabilities`_ to have security discussions:
* File security issues.
* Discuss security improvements to LLVM.
-We also occasionally need to discuss logistics of the LLVM Security Group itself:
+We also occasionally need to discuss logistics of the LLVM Security Response Group itself:
* Nominate new members.
* Propose member removal.
@@ -180,14 +180,14 @@ Process
The following process occurs on the discussion medium for each reported issue:
* A security issue reporter (not necessarily an LLVM contributor) reports an issue.
-* Within two business days, a member of the Security Group is put in charge of driving the issue to an acceptable resolution. This champion doesn’t need to be the same person for each issue. This person can self-nominate.
-* Members of the Security Group discuss in which circumstances (if any) an issue is relevant to security, and determine if it is a security issue.
+* Within two business days, a member of the LLVM Security Response Group is put in charge of driving the issue to an acceptable resolution. This champion doesn’t need to be the same person for each issue. This person can self-nominate.
+* Members of the LLVM Security Response Group discuss in which circumstances (if any) an issue is relevant to security, and determine if it is a security issue.
* Negotiate an embargo date for public disclosure, with a default minimum time limit of ninety days.
-* Security Group members can recommend that key experts be pulled in to specific issue discussions. The key expert can be pulled in unless there are objections from other Security Group members.
+* LLVM Security Response Group members can recommend that key experts be pulled in to specific issue discussions. The key expert can be pulled in unless there are objections from other LLVM Security Response Group members.
* Patches are written and reviewed.
-* Backporting security patches from recent versions to old versions cannot always work. It is up to the Security Group to decide if such backporting should be done, and how far back.
-* The Security Group figures out how the LLVM project’s own releases, as well as individual vendors’ releases, can be timed to patch the issue simultaneously.
-* Embargo date can be delayed or pulled forward at the Security Group’s discretion.
+* Backporting security patches from recent versions to old versions cannot always work. It is up to the LLVM Security Response Group to decide if such backporting should be done, and how far back.
+* The LLVM Security Response Group figures out how the LLVM project’s own releases, as well as individual vendors’ releases, can be timed to patch the issue simultaneously.
+* Embargo date can be delayed or pulled forward at the LLVM Security Response Group’s discretion.
* The issue champion obtains a CVE entry from MITRE_.
* Once the embargo expires, the patch is posted publicly according to LLVM’s usual code review process.
* All security issues (as well as nomination / removal discussions) become public within approximately fourteen weeks of the fix landing in the LLVM repository. Precautions should be taken to avoid disclosing particularly sensitive data included in the report (e.g. username and password pairs).
@@ -196,7 +196,7 @@ The following process occurs on the discussion medium for each reported issue:
Changes to the Policy
=====================
-The LLVM Security Policy may be changed by majority vote of the LLVM Security Group. Such changes also need to be approved by the LLVM Board.
+The LLVM Security Policy may be changed by majority vote of the LLVM Security Response Group. Such changes also need to be approved by the LLVM Board.
What is considered a security issue?
@@ -216,12 +216,12 @@ community as for any RFC. In some cases, parts of the codebase could be handled
as security-sensitive but need significant work to get to the stage where that's
manageable. The LLVM community will need to decide whether it wants to invest in
making these parts of the code securable, and maintain these security
-properties over time. In all cases the LLVM Security Group should be consulted,
+properties over time. In all cases the LLVM Security Response Group should be consulted,
since they'll be responding to security issues filed against these parts of the
codebase.
If you're not sure whether an issue is in-scope for this security process or
-not, err towards assuming that it is. The Security Group might agree or disagree
+not, err towards assuming that it is. The Security Response Group might agree or disagree
and will explain its rationale in the report, as well as update this document
through the above process.
@@ -229,7 +229,7 @@ The security-sensitive parts of the LLVM Project currently are the following.
Note that this list can change over time.
* None are currently defined. Please don't let this stop you from reporting
- issues to the security group that you believe are security-sensitive.
+ issues to the LLVM Security Response Group that you believe are security-sensitive.
The parts of the LLVM Project which are currently treated as non-security
sensitive are the following. Note that this list can change over time.
diff --git a/llvm/docs/StackMaps.rst b/llvm/docs/StackMaps.rst
index d94274138eb2..11b6b3e2ca32 100644
--- a/llvm/docs/StackMaps.rst
+++ b/llvm/docs/StackMaps.rst
@@ -112,8 +112,9 @@ Operands:
The first operand is an ID to be encoded within the stack map. The
second operand is the number of shadow bytes following the
-intrinsic. The variable number of operands that follow are the ``live
-values`` for which locations will be recorded in the stack map.
+intrinsic. These first two operands should be immediate, e.g. cannot
+be passed as variables. The variable number of operands that follow are
+the ``live values`` for which locations will be recorded in the stack map.
To use this intrinsic as a bare-bones stack map, with no code patching
support, the number of shadow bytes can be set to zero.
diff --git a/llvm/docs/TableGen/ProgRef.rst b/llvm/docs/TableGen/ProgRef.rst
index 03fe1157b404..cfe61382658e 100644
--- a/llvm/docs/TableGen/ProgRef.rst
+++ b/llvm/docs/TableGen/ProgRef.rst
@@ -223,12 +223,13 @@ TableGen provides "bang operators" that have a wide variety of uses:
: !div !empty !eq !exists !filter
: !find !foldl !foreach !ge !getdagarg
: !getdagname !getdagop !gt !head !if
- : !interleave !isa !le !listconcat !listflatten
- : !listremove !listsplat !logtwo !lt !mul
- : !ne !not !or !range !repr
- : !setdagarg !setdagname !setdagop !shl !size
- : !sra !srl !strconcat !sub !subst
- : !substr !tail !tolower !toupper !xor
+ : !initialized !interleave !isa !le !listconcat
+ : !listflatten !listremove !listsplat !logtwo !lt
+ : !mul !ne !not !or !range
+ : !repr !setdagarg !setdagname !setdagop !shl
+ : !size !sra !srl !strconcat !sub
+ : !subst !substr !tail !tolower !toupper
+ : !xor
The ``!cond`` operator has a slightly different
syntax compared to other bang operators, so it is defined separately:
@@ -555,7 +556,7 @@ previous case, if the *right-hand-side* operand is an undefined name or a
global name, it is treated as a verbatim string of characters. The
left-hand-side operand is treated normally.
-Values can have a trailing paste operator, in which case the left-hand-side
+Values can have a trailing paste operator, in which case the left-hand-side
operand is concatenated to an empty string.
`Appendix B: Paste Operator Examples`_ presents examples of the behavior of
@@ -1815,6 +1816,10 @@ and non-0 as true.
``int``. If the result is not 0, the *then* expression is produced; otherwise
the *else* expression is produced.
+``!initialized(``\ *a*\ ``)``
+ This operator produces 1 if *a* is not the uninitialized value (``?``) and 0
+ otherwise.
+
``!interleave(``\ *list*\ ``,`` *delim*\ ``)``
This operator concatenates the items in the *list*, interleaving the
*delim* string between each pair, and produces the resulting string.
diff --git a/llvm/docs/Telemetry.rst b/llvm/docs/Telemetry.rst
new file mode 100644
index 000000000000..4f30ae82b562
--- /dev/null
+++ b/llvm/docs/Telemetry.rst
@@ -0,0 +1,257 @@
+===========================
+Telemetry framework in LLVM
+===========================
+
+.. contents::
+ :local:
+
+.. toctree::
+ :hidden:
+
+Objective
+=========
+
+Provides a common framework in LLVM for collecting various usage and performance
+metrics.
+It is located at ``llvm/Telemetry/Telemetry.h``.
+
+Characteristics
+---------------
+* Configurable and extensible by:
+
+ * Tools: any tool that wants to use Telemetry can extend and customize it.
+ * Vendors: Toolchain vendors can also provide custom implementation of the
+ library, which could either override or extend the given tool's upstream
+ implementation, to best fit their organization's usage and privacy models.
+ * End users of such tool can also configure Telemetry (as allowed by their
+ vendor).
+
+Important notes
+---------------
+
+* There is no concrete implementation of a Telemetry library in upstream LLVM.
+ We only provide the abstract API here. Any tool that wants telemetry will
+ implement one.
+
+ The rationale for this is that all the tools in LLVM are very different in
+ what they care about (what/where/when to instrument data). Hence, it might not
+ be practical to have a single implementation.
+ However, in the future, if we see enough common pattern, we can extract them
+ into a shared place. This is TBD - contributions are welcome.
+
+* No implementation of Telemetry in upstream LLVM shall store any of the
+ collected data due to privacy and security reasons:
+
+ * Different organizations have different privacy models:
+
+ * Which data is sensitive, which is not?
+ * Whether it is acceptable for instrumented data to be stored anywhere?
+ (to a local file, what not?)
+
+ * Data ownership and data collection consents are hard to accommodate from
+ LLVM developers' point of view:
+
+ * E.g., data collected by Telemetry is not necessarily owned by the user
+ of an LLVM tool with Telemetry enabled, hence the user's consent to data
+ collection is not meaningful. On the other hand, LLVM developers have no
+ reasonable ways to request consent from the "real" owners.
+
+
+High-level design
+=================
+
+Key components
+--------------
+
+The framework consists of four important classes:
+
+* ``llvm::telemetry::Manager``: The class responsible for collecting and
+ transmitting telemetry data. This is the main point of interaction between the
+ framework and any tool that wants to enable telemetry.
+* ``llvm::telemetry::TelemetryInfo``: Data courier
+* ``llvm::telemetry::Destination``: Data sink to which the Telemetry framework
+ sends data.
+ Its implementation is transparent to the framework.
+ It is up to the vendor to decide which pieces of data to forward and where
+ to forward them to for their final storage.
+* ``llvm::telemetry::Config``: Configurations for the ``Manager``.
+
+.. image:: llvm_telemetry_design.png
+
+How to implement and interact with the API
+------------------------------------------
+
+To use Telemetry in your tool, you need to provide a concrete implementation of the ``Manager`` class and ``Destination``.
+
+1) Define a custom ``Serializer``, ``Manager``, ``Destination`` and optionally a subclass of ``TelemetryInfo``
+
+.. code-block:: c++
+
+ class JsonSerializer : public Serializer {
+ public:
+ json::Object *getOutputObject() { return Out.get(); }
+
+ Error init() override {
+ if (Started)
+ return createStringError("Serializer already in use");
+ started = true;
+ Out = std::make_unique<json::Object>();
+ return Error::success();
+ }
+
+ // Serialize the given value.
+ void write(StringRef KeyName, bool Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, int Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, long Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, long long Value ) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, unsigned int Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, unsigned long Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, unsigned long long Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void write(StringRef KeyName, StringRef Value) override {
+ writeHelper(KeyName, Value);
+ }
+
+ void beginObject(StringRef KeyName) override {
+ Children.push_back(json::Object());
+ ChildrenNames.push_back(KeyName.str());
+ }
+
+ void endObject() override {
+ assert(!Children.empty() && !ChildrenNames.empty());
+ json::Value Val = json::Value(std::move(Children.back()));
+ std::string Name = ChildrenNames.back();
+
+ Children.pop_back();
+ ChildrenNames.pop_back();
+ writeHelper(Name, std::move(Val));
+ }
+
+ Error finalize() override {
+ if (!Started)
+ return createStringError("Serializer not currently in use");
+ Started = false;
+ return Error::success();
+ }
+
+ private:
+ template <typename T> void writeHelper(StringRef Name, T Value) {
+ assert(Started && "serializer not started");
+ if (Children.empty())
+ Out->try_emplace(Name, Value);
+ else
+ Children.back().try_emplace(Name, Value);
+ }
+ bool Started = false;
+ std::unique_ptr<json::Object> Out;
+ std::vector<json::Object> Children;
+ std::vector<std::string> ChildrenNames;
+ };
+
+ class MyManager : public telemery::Manager {
+ public:
+ static std::unique_ptr<MyManager> createInstatnce(telemetry::Config *Config) {
+ // If Telemetry is not enabled, then just return null;
+ if (!Config->EnableTelemetry)
+ return nullptr;
+ return std::make_unique<MyManager>();
+ }
+ MyManager() = default;
+
+ Error preDispatch(TelemetryInfo *Entry) override {
+ Entry->SessionId = SessionId;
+ return Error::success();
+ }
+
+ // You can also define additional instrumentation points.
+ void logStartup(TelemetryInfo *Entry) {
+ // Add some additional data to entry.
+ Entry->Msg = "Some message";
+ dispatch(Entry);
+ }
+
+ void logAdditionalPoint(TelemetryInfo *Entry) {
+ // .... code here
+ }
+
+ private:
+ const std::string SessionId;
+ };
+
+ class MyDestination : public telemetry::Destination {
+ public:
+ Error receiveEntry(const TelemetryInfo *Entry) override {
+ if (Error Err = Serializer.init())
+ return Err;
+
+ Entry->serialize(Serializer);
+ if (Error Err = Serializer.finalize())
+ return Err;
+
+ json::Object Copied = *Serializer.getOutputObject();
+ // Send the `Copied` object to wherever.
+ return Error::success();
+ }
+
+ private:
+ JsonSerializer Serializer;
+ };
+
+ // This defines a custom TelemetryInfo that has an additional Msg field.
+ struct MyTelemetryInfo : public telemetry::TelemetryInfo {
+ std::string Msg;
+
+ Error serialize(Serializer &Serializer) const override {
+ TelemetryInfo::serialize(serializer);
+ Serializer.writeString("MyMsg", Msg);
+ }
+
+ // Note: implement getKind() and classof() to support dyn_cast operations.
+ };
+
+
+2) Use the library in your tool.
+
+Logging the tool init-process:
+
+.. code-block:: c++
+
+ // In tool's initialization code.
+ auto StartTime = std::chrono::time_point<std::chrono::steady_clock>::now();
+ telemetry::Config MyConfig = makeConfig(); // Build up the appropriate Config struct here.
+ auto Manager = MyManager::createInstance(&MyConfig);
+
+
+ // Any other tool's init code can go here.
+ // ...
+
+ // Finally, take a snapshot of the time now so we know how long it took the
+ // init process to finish.
+ auto EndTime = std::chrono::time_point<std::chrono::steady_clock>::now();
+ MyTelemetryInfo Entry;
+
+ Entry.Start = StartTime;
+ Entry.End = EndTime;
+ Manager->logStartup(&Entry);
+
+Similar code can be used for logging the tool's exit.
diff --git a/llvm/docs/TestSuiteGuide.md b/llvm/docs/TestSuiteGuide.md
index 35984bd6f7b3..aa8332ed8b7e 100644
--- a/llvm/docs/TestSuiteGuide.md
+++ b/llvm/docs/TestSuiteGuide.md
@@ -367,6 +367,19 @@ For the SPEC benchmarks you can switch between the `test`, `train` and
`ref` input datasets via the `TEST_SUITE_RUN_TYPE` configuration option.
The `train` dataset is used by default.
+In addition to SPEC, the multimedia frameworks ffmpeg and dav1d can also
+be hooked up as external projects in the same way. By including them in
+llvm-test-suite, a lot more of potentially vectorizable code gets compiled
+- which can catch compiler bugs merely by triggering code generation asserts.
+Including them also adds small code correctness tests, that compare the
+output of the compiler generated functions against handwritten assembly
+functions. (On x86, building the assembly requires having the nasm tool
+available.) The integration into llvm-test-suite doesn't run the projects'
+full testsuites though. The projects also contain microbenchmarks for
+measuring the performance of some functions. See the `README.md` files in
+the respective `ffmpeg` and `dav1d` directories under
+`llvm-test-suite/External` for further details.
+
Custom Suites
-------------
diff --git a/llvm/docs/UndefinedBehavior.rst b/llvm/docs/UndefinedBehavior.rst
new file mode 100644
index 000000000000..82ae20c74f33
--- /dev/null
+++ b/llvm/docs/UndefinedBehavior.rst
@@ -0,0 +1,440 @@
+======================================
+LLVM IR Undefined Behavior (UB) Manual
+======================================
+
+.. contents::
+ :local:
+ :depth: 2
+
+Abstract
+========
+This document describes the undefined behavior (UB) in LLVM's IR, including
+undef and poison values, as well as the ``freeze`` instruction.
+We also provide guidelines on when to use each form of UB.
+
+
+Introduction
+============
+Undefined behavior (UB) is used to specify the behavior of corner cases for
+which we don't wish to specify the concrete results. UB is also used to provide
+additional constraints to the optimizers (e.g., assumptions that the frontend
+guarantees through the language type system or the runtime).
+For example, we could specify the result of division by zero as zero, but
+since we are not really interested in the result, we say it is UB.
+
+There exist two forms of undefined behavior in LLVM: immediate UB and deferred
+UB. The latter comes in two flavors: undef and poison values.
+There is also a ``freeze`` instruction to tame the propagation of deferred UB.
+The lattice of values in LLVM is:
+immediate UB > poison > undef > freeze(poison) > concrete value.
+
+We explain each of the concepts in detail below.
+
+
+Immediate UB
+============
+Immediate UB is the most severe form of UB. It should be avoided whenever
+possible.
+Immediate UB should be used only for operations that trap in most CPUs supported
+by LLVM.
+Examples include division by zero, dereferencing a null pointer, etc.
+
+The reason that immediate UB should be avoided is that it makes optimizations
+such as hoisting a lot harder.
+Consider the following example:
+
+.. code-block:: llvm
+
+ define i32 @f(i1 %c, i32 %v) {
+ br i1 %c, label %then, label %else
+
+ then:
+ %div = udiv i32 3, %v
+ br label %ret
+
+ else:
+ br label %ret
+
+ ret:
+ %r = phi i32 [ %div, %then ], [ 0, %else ]
+ ret i32 %r
+ }
+
+We might be tempted to simplify this function by removing the branching and
+executing the division speculatively because ``%c`` is true most of times.
+We would obtain the following IR:
+
+.. code-block:: llvm
+
+ define i32 @f(i1 %c, i32 %v) {
+ %div = udiv i32 3, %v
+ %r = select i1 %c, i32 %div, i32 0
+ ret i32 %r
+ }
+
+However, this transformation is not correct! Since division triggers UB
+when the divisor is zero, we can only execute speculatively if we are sure we
+don't hit that condition.
+The function above, when called as ``f(false, 0)``, would return 0 before the
+optimization, and triggers UB after being optimized.
+
+This example highlights why we minimize the cases that trigger immediate UB
+as much as possible.
+As a rule of thumb, use immediate UB only for the cases that trap the CPU for
+most of the supported architectures.
+
+
+Time Travel
+-----------
+Immediate UB in LLVM IR allows the so-called time travelling. What this means
+is that if a program triggers UB, then we are not required to preserve any of
+its observable behavior, including I/O.
+For example, the following function triggers UB after calling ``printf``:
+
+.. code-block:: llvm
+
+ define void @fn() {
+ call void @printf(...) willreturn
+ unreachable
+ }
+
+Since we know that ``printf`` will always return, and because LLVM's UB can
+time-travel, it is legal to remove the call to ``printf`` altogether and
+optimize the function to simply:
+
+.. code-block:: llvm
+
+ define void @fn() {
+ unreachable
+ }
+
+
+Deferred UB
+===========
+Deferred UB is a lighter form of UB. It enables instructions to be executed
+speculatively while marking some corner cases as having erroneous values.
+Deferred UB should be used for cases where the semantics offered by common
+CPUs differ, but the CPU does not trap.
+
+As an example, consider the shift instructions. The x86 and ARM architectures
+offer different semantics when the shift amount is equal to or greater than
+the bitwidth.
+We could solve this tension in one of two ways: 1) pick one of the x86/ARM
+semantics for LLVM, which would make the code emitted for the other architecture
+slower; 2) define that case as yielding ``poison``.
+LLVM chose the latter option. For frontends for languages like C or C++
+(e.g., clang), they can map shifts in the source program directly to a shift in
+LLVM IR, since the semantics of C and C++ define such shifts as UB.
+For languages that offer strong semantics, they must use the value of the shift
+conditionally, e.g.:
+
+.. code-block:: llvm
+
+ define i32 @x86_shift(i32 %a, i32 %b) {
+ %mask = and i32 %b, 31
+ %shift = shl i32 %a, %mask
+ ret i32 %shift
+ }
+
+
+There are two deferred UB values in LLVM: ``undef`` and ``poison``, which we
+describe next.
+
+
+Undef Values
+------------
+.. warning::
+ Undef values are deprecated and should be used only when strictly necessary.
+ Uses of undef values should be restricted to representing loads of
+ uninitialized memory. This is the only part of the IR semantics that cannot
+ be replaced with alternatives yet (work in ongoing).
+
+An undef value represents any value of a given type. Moreover, each use of
+an instruction that depends on undef can observe a different value.
+For example:
+
+.. code-block:: llvm
+
+ define i32 @fn() {
+ %add = add i32 undef, 0
+ %ret = add i32 %add, %add
+ ret i32 %ret
+ }
+
+Unsurprisingly, the first addition yields ``undef``.
+However, the result of the second addition is more subtle. We might be tempted
+to think that it yields an even number. But it might not be!
+Since each (transitive) use of ``undef`` can observe a different value,
+the second addition is equivalent to ``add i32 undef, undef``, which is
+equivalent to ``undef``.
+Hence, the function above is equivalent to:
+
+.. code-block:: llvm
+
+ define i32 @fn() {
+ ret i32 undef
+ }
+
+Each call to this function may observe a different value, namely any 32-bit
+number (even and odd).
+
+Because each use of undef can observe a different value, some optimizations
+are wrong if we are not sure a value is not undef.
+Consider a function that multiplies a number by 2:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %v) {
+ %mul2 = mul i32 %v, 2
+ ret i32 %mul2
+ }
+
+This function is guaranteed to return an even number, even if ``%v`` is
+undef.
+However, as we've seen above, the following function does not:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %v) {
+ %mul2 = add i32 %v, %v
+ ret i32 %mul2
+ }
+
+This optimization is wrong just because undef values exist, even if they are
+not used in this part of the program as LLVM has no way to tell if ``%v`` is
+undef or not.
+
+Looking at the value lattice, ``undef`` values can only be replaced with either
+a ``freeze`` instruction or a concrete value.
+A consequence is that giving undef as an operand to an instruction that triggers
+UB for some values of that operand makes the program UB. For example,
+``udiv %x, undef`` is UB since we replace undef with 0 (``udiv %x, 0``),
+becoming obvious that it is UB.
+
+
+Poison Values
+-------------
+Poison values are a stronger form of deferred UB than undef. They still
+allow instructions to be executed speculatively, but they taint the whole
+expression DAG (with some exceptions), akin to floating point NaN values.
+
+Example:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %a, i32 %b, i32 %c) {
+ %add = add nsw i32 %a, %b
+ %ret = add nsw i32 %add, %c
+ ret i32 %ret
+ }
+
+The ``nsw`` attribute in the additions indicates that the operation yields
+poison if there is a signed overflow.
+If the first addition overflows, ``%add`` is poison and thus ``%ret`` is also
+poison since it taints the whole expression DAG.
+
+Poison values can be replaced with any value of type (undef, concrete values,
+or a ``freeze`` instruction).
+
+
+Propagation of Poison Through Select
+------------------------------------
+Most instructions return poison if any of their inputs is poison.
+A notable exception is the ``select`` instruction, which is poison if and
+only if the condition is poison or the selected value is poison.
+This means that ``select`` acts as a barrier for poison propagation, which
+impacts which optimizations can be performed.
+
+For example, consider the following function:
+
+.. code-block:: llvm
+
+ define i1 @fn(i32 %x, i32 %y) {
+ %cmp1 = icmp ne i32 %x, 0
+ %cmp2 = icmp ugt i32 %x, %y
+ %and = select i1 %cmp1, i1 %cmp2, i1 false
+ ret i1 %and
+ }
+
+It is not correct to optimize the ``select`` into an ``and`` because when
+``%cmp1`` is false, the ``select`` is only poison if ``%x`` is poison, while
+the ``and`` below is poison if either ``%x`` or ``%y`` are poison.
+
+.. code-block:: llvm
+
+ define i1 @fn(i32 %x, i32 %y) {
+ %cmp1 = icmp ne i32 %x, 0
+ %cmp2 = icmp ugt i32 %x, %y
+ %and = and i1 %cmp1, %cmp2 ;; poison if %x or %y are poison
+ ret i1 %and
+ }
+
+However, the optimization is possible if all operands of the values are used in
+the condition (notice the flipped operands in the ``select``):
+
+.. code-block:: llvm
+
+ define i1 @fn(i32 %x, i32 %y) {
+ %cmp1 = icmp ne i32 %x, 0
+ %cmp2 = icmp ugt i32 %x, %y
+ %and = select i1 %cmp2, i1 %cmp1, i1 false
+ ; ok to replace with:
+ %and = and i1 %cmp1, %cmp2
+ ret i1 %and
+ }
+
+
+The Freeze Instruction
+======================
+Both undef and poison values sometimes propagate too much down an expression
+DAG. Undef values because each transitive use can observe a different value,
+and poison values because they make the whole DAG poison.
+There are some cases where it is important to stop such propagation.
+This is where the ``freeze`` instruction comes in.
+
+Take the following example function:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %n, i1 %c) {
+ entry:
+ br label %loop
+
+ loop:
+ %i = phi i32 [ 0, %entry ], [ %i2, %loop.end ]
+ %cond = icmp ule i32 %i, %n
+ br i1 %cond, label %loop.cont, label %exit
+
+ loop.cont:
+ br i1 %c, label %then, label %else
+
+ then:
+ ...
+ br label %loop.end
+
+ else:
+ ...
+ br label %loop.end
+
+ loop.end:
+ %i2 = add i32 %i, 1
+ br label %loop
+
+ exit:
+ ...
+ }
+
+Imagine we want to perform loop unswitching on the loop above since the branch
+condition inside the loop is loop invariant.
+We would obtain the following IR:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %n, i1 %c) {
+ entry:
+ br i1 %c, label %then, label %else
+
+ then:
+ %i = phi i32 [ 0, %entry ], [ %i2, %then.cont ]
+ %cond = icmp ule i32 %i, %n
+ br i1 %cond, label %then.cont, label %exit
+
+ then.cont:
+ ...
+ %i2 = add i32 %i, 1
+ br label %then
+
+ else:
+ %i3 = phi i32 [ 0, %entry ], [ %i4, %else.cont ]
+ %cond = icmp ule i32 %i3, %n
+ br i1 %cond, label %else.cont, label %exit
+
+ else.cont:
+ ...
+ %i4 = add i32 %i3, 1
+ br label %else
+
+ exit:
+ ...
+ }
+
+There is a subtle catch: when the function is called with ``%n`` being zero,
+the original function did not branch on ``%c``, while the optimized one does.
+Branching on a deferred UB value is immediate UB, hence the transformation is
+wrong in general because ``%c`` may be undef or poison.
+
+Cases like this need a way to tame deferred UB values. This is exactly what the
+``freeze`` instruction is for!
+When given a concrete value as argument, ``freeze`` is a no-op, returning the
+argument as-is. When given an undef or poison value, ``freeze`` returns a
+non-deterministic value of the type.
+This is not the same as undef: the value returned by ``freeze`` is the same
+for all users.
+
+Branching on a value returned by ``freeze`` is always safe since it either
+evaluates to true or false consistently.
+We can make the loop unswitching optimization above correct as follows:
+
+.. code-block:: llvm
+
+ define i32 @fn(i32 %n, i1 %c) {
+ entry:
+ %c2 = freeze i1 %c
+ br i1 %c2, label %then, label %else
+
+
+Writing Tests Without Undefined Behavior
+========================================
+
+When writing tests, it is important to ensure that they don't trigger UB
+unnecessarily. Some automated test reduces sometimes use undef or poison
+values as dummy values, but this is considered a bad practice if this leads
+to triggering UB.
+
+For example, imagine that we want to write a test and we don't care about the
+particular divisor value because our optimization kicks in regardless:
+
+.. code-block:: llvm
+
+ define i32 @fn(i8 %a) {
+ %div = udiv i8 %a, poison
+ ...
+ }
+
+The issue with this test is that it triggers immediate UB. This prevents
+verification tools like Alive from validating the correctness of the
+optimization. Hence, it is considered a bad practice to have tests with
+unnecessary immediate UB (unless that is exactly what the test is for).
+The test above should use a dummy function argument instead of using poison:
+
+.. code-block:: llvm
+
+ define i32 @fn(i8 %a, i8 %dummy) {
+ %div = udiv i8 %a, %dummy
+ ...
+ }
+
+Common sources of immediate UB in tests include branching on undef/poison
+conditions and dereferencing undef/poison/null pointers.
+
+.. note::
+ If you need a placeholder value to pass as an argument to an instruction
+ that may trigger UB, add a new argument to the function rather than using
+ undef or poison.
+
+
+Summary
+=======
+Undefined behavior (UB) in LLVM IR consists of two well-defined concepts:
+immediate and deferred UB (undef and poison values).
+Passing deferred UB values to certain operations leads to immediate UB.
+This can be avoided in some cases through the use of the ``freeze``
+instruction.
+
+The lattice of values in LLVM is:
+immediate UB > poison > undef > freeze(poison) > concrete value.
+It is only valid to transform values from the left to the right (e.g., a poison
+value can be replaced with a concrete value, but not the other way around).
+
+Undef is now deprecated and should be used only to represent loads of
+uninitialized memory.
diff --git a/llvm/docs/UserGuides.rst b/llvm/docs/UserGuides.rst
index 0b204d512876..6eee564713d6 100644
--- a/llvm/docs/UserGuides.rst
+++ b/llvm/docs/UserGuides.rst
@@ -72,6 +72,7 @@ intermediate LLVM representation.
SupportLibrary
TableGen/index
TableGenFundamentals
+ Telemetry
Vectorizers
WritingAnLLVMPass
WritingAnLLVMNewPMPass
@@ -293,3 +294,6 @@ Additional Topics
:doc:`Sandbox IR <SandboxIR>`
This document describes the design and usage of Sandbox IR, a transactional layer over LLVM IR.
+
+:doc:`Telemetry`
+ This document describes the Telemetry framework in LLVM.
diff --git a/llvm/docs/Vectorizers.rst b/llvm/docs/Vectorizers.rst
index c2beb1669c4e..f134a6df94a6 100644
--- a/llvm/docs/Vectorizers.rst
+++ b/llvm/docs/Vectorizers.rst
@@ -345,6 +345,16 @@ instruction is available.
f[i] = floorf(f[i]);
}
+Many of these math functions are only vectorizable if the file has been built
+with a specified target vector library that provides a vector implemention
+of that math function. Using clang, this is handled by the "-fveclib" command
+line option with one of the following vector libraries:
+"accelerate,libmvec,massv,svml,sleef,darwin_libsystem_m,armpl,amdlibm"
+
+.. code-block:: console
+
+ $ clang ... -fno-math-errno -fveclib=libmvec file.c
+
Partial unrolling during vectorization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -389,6 +399,19 @@ small trip counts.
.. image:: epilogue-vectorization-cfg.png
+Early Exit Vectorization
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+When vectorizing a loop with a single early exit, the loop blocks following the
+early exit are predicated and the vector loop will always exit via the latch.
+If the early exit has been taken, the vector loop's successor block
+(``middle.split`` below) branches to the early exit block. Otherwise
+``middle.block`` selects between the exit block from the latch or the scalar
+remainder loop.
+
+.. image:: vplan-early-exit.png
+
+
Performance
-----------
diff --git a/llvm/docs/llvm_telemetry_design.png b/llvm/docs/llvm_telemetry_design.png
new file mode 100644
index 000000000000..48fbc003da18
--- /dev/null
+++ b/llvm/docs/llvm_telemetry_design.png
Binary files differ
diff --git a/llvm/docs/requirements-hashed.txt b/llvm/docs/requirements-hashed.txt
index 64cfc8fc7979..07e051ca4a8b 100644
--- a/llvm/docs/requirements-hashed.txt
+++ b/llvm/docs/requirements-hashed.txt
@@ -314,6 +314,7 @@ sphinx==7.2.6 \
# recommonmark
# sphinx-automodapi
# sphinx-basic-ng
+ # sphinx-reredirects
# sphinxcontrib-devhelp
# sphinxcontrib-htmlhelp
# sphinxcontrib-qthelp
@@ -334,6 +335,10 @@ sphinx-markdown-tables==0.0.17 \
--hash=sha256:2bd0c30779653e4dd120300cbd9ca412c480738cc2241f6dea477a883f299e04 \
--hash=sha256:6bc6d3d400eaccfeebd288446bc08dd83083367c58b85d40fe6c12d77ef592f1
# via -r requirements.txt
+sphinx-reredirects==0.1.2 \
+ --hash=sha256:3a22161771aadd448bb608a4fe7277252182a337af53c18372b7104531d71489 \
+ --hash=sha256:a0e7213304759b01edc22f032f1715a1c61176fc8f167164e7a52b9feec9ac64
+ # via -r requirements.txt
sphinxcontrib-applehelp==1.0.8 \
--hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619 \
--hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4
diff --git a/llvm/docs/requirements.txt b/llvm/docs/requirements.txt
index 960a6eb644e1..50cf8ef58e75 100644
--- a/llvm/docs/requirements.txt
+++ b/llvm/docs/requirements.txt
@@ -5,5 +5,6 @@ recommonmark==0.7.1
sphinx-automodapi==0.17.0
sphinx-bootstrap-theme==0.8.1
sphinxcontrib-applehelp==1.0.8
+sphinx-reredirects==0.1.2
furo==2024.1.29
myst-parser==2.0.0
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
index 8fd4c39d3ff4..ed1dea232491 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
@@ -336,7 +336,7 @@ the function:
/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
/// the function. This is used for mutable variables etc.
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
- const std::string &VarName) {
+ StringRef VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
return TmpB.CreateAlloca(Type::getDoubleTy(*TheContext), nullptr,
@@ -440,11 +440,11 @@ get good codegen once again:
.. code-block:: c++
// Promote allocas to registers.
- TheFPM->add(createPromoteMemoryToRegisterPass());
+ TheFPM->addPass(PromotePass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
- TheFPM->add(createInstructionCombiningPass());
+ TheFPM->addPass(InstCombinePass());
// Reassociate expressions.
- TheFPM->add(createReassociatePass());
+ TheFPM->addPass(ReassociatePass());
...
It is interesting to see what the code looks like before and after the
diff --git a/llvm/docs/vplan-early-exit.dot b/llvm/docs/vplan-early-exit.dot
new file mode 100644
index 000000000000..63490b0cdb2e
--- /dev/null
+++ b/llvm/docs/vplan-early-exit.dot
@@ -0,0 +1,41 @@
+digraph VPlan {
+graph [labelloc=t, fontsize=30; label=""]
+node [shape=rect, fontname=Courier, fontsize=30]
+edge [fontname=Courier, fontsize=30]
+compound=true
+ N1 [label =
+ "vector.ph"
+ ]
+ N1 -> N2 [ label="" lhead=cluster_N3]
+ subgraph cluster_N3 {
+ fontname=Courier
+ label="\<x1\> vector loop"
+ N2 [label =
+ "vector.body"
+ ]
+ }
+ N2 -> N4 [ label="" ltail=cluster_N3]
+ N4 [label =
+ "middle.split"
+ ]
+ N4 -> N5 [ label=""]
+ N4 -> N6 [ label=""]
+ N5 [label =
+ "early.exit"
+ ]
+ N6 [label =
+ "middle.block"
+ ]
+ N6 -> N9 [ label=""]
+ N6 -> N7 [ label=""]
+ N7 [label =
+ "scalar.ph"
+ ]
+ N7 -> N8 [ label=""]
+ N8 [label =
+ "loop.header"
+ ]
+ N9 [label =
+ "latch.exit"
+ ]
+}
diff --git a/llvm/docs/vplan-early-exit.png b/llvm/docs/vplan-early-exit.png
new file mode 100644
index 000000000000..3cd293bcdbcc
--- /dev/null
+++ b/llvm/docs/vplan-early-exit.png
Binary files differ