[llvm] [IR] Require index width to be ule pointer width (PR #70015)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 02:36:46 PDT 2023


================
@@ -11030,6 +11031,24 @@ for the given testcase is equivalent to:
       ret ptr %t5
     }
 
+The indices are first converted to offsets in the pointer's index type. If the
+currently indexed type is a struct type, the struct offset corresponding to the
+index is sign-extended or truncated to the pointer index type. Otherwise, the
+index itself is sign-extended or truncated, and then multiplied by the type
+allocation size (that is, the size rounded up to the ABI alignment) of the
+currently indexed type.
+
+The offsets are then added to the low bits of the base address up to the index
+type width, with silently-wrapping two's complement arithmetic. If the pointer
+size is larger than the index size, this means that the bits outside the index
+type width will not be affected.
----------------
jayfoad wrote:

Thanks!

https://github.com/llvm/llvm-project/pull/70015


More information about the llvm-commits mailing list