================ @@ -11295,27 +11297,46 @@ memory though, even if it happens to point into allocated storage. See the :ref:`Pointer Aliasing Rules <pointeraliasing>` section for more information. -If the ``inbounds`` keyword is present, the result value of a -``getelementptr`` with any non-zero indices is a -:ref:`poison value <poisonvalues>` if one of the following rules is violated: - -* The base pointer has an *in bounds* address of an allocated object, which +The ``getelementptr`` instruction may have a number of attributes that impose +additional rules. If any of the rules are violated, the result value is a +:ref:`poison value <poisonvalues>`. In cases where the base is a vector of +pointers, the attributes apply to each computation element-wise. + +For ``nusw`` (no unsigned signed wrap): + + * If the type of an index is larger than the pointer index type, the + truncation to the pointer index type preserves the signed value + (``trunc nsw``). + * The multiplication of an index by the type size does not wrap the pointer + index type in a signed sense (``mul nsw``). + * The successive addition of each offset (without adding the base address) + does not wrap the pointer index type in a signed sense (``add nsw``). + * The successive addition of the current address, truncated to the index type + and interpreted as an unsigned number, and each offset, interpreted as + a signed number, does not wrap the index type. ---------------- goldsteinn wrote:
Also maybe im a bit confused, but should this not be 'pointer index type'? https://github.com/llvm/llvm-project/pull/90824 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits