[llvm] [IR] Add llvm.structured.gep instruction (PR #167883)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 18 08:02:21 PST 2025
================
@@ -14841,6 +14841,180 @@ Semantics:
See the description for :ref:`llvm.stacksave <int_stacksave>`.
+.. _i_structured_gep:
+
+'``llvm.structured.gep``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+ <result> = call ptr llvm.structured.gep <basetype> poison, ptr <source>, {, [i32/i64] <index> }*
+
+Overview:
+"""""""""
+
+The '``llvm.structured.gep``' intrinsic (structured **G**\ et\ **E**\ lement\ **P**\ tr) computes a new pointer address
+resulting of a logical indexing into the ``<source>`` pointer. The returned
+address depends on the indices and may depend on the layout of %basetype at
+runtime.
+
+Arguments:
+""""""""""
+
+``<ty> basetype``:
+The type of the element pointed by the pointer source. This type will be
+used along with the provided indices and source operands to compute a new
+pointer representing the result of a logical indexing into a basetype
+pointed by source.
+The actual value passed is ignored, and should be ``poison``.
+
+``ptr <source>``:
+A pointer to a valid memory location assumed to be large enough to hold a
+completely laid out value with the same type as ``basetype``. The physical
+layout of ``basetype`` is target dependent, and is not always known at
+compile time.
----------------
Keenuts wrote:
Removed those bits, but expanded on the link between the type and the source pointer saying this link is only relevant for this particular intrinsic call, and could not be used to infer anything outside of it.
Example: accessing a union: same source pointer, different basetypes.
https://github.com/llvm/llvm-project/pull/167883
More information about the llvm-commits
mailing list