[llvm] [IR] Require that ptrmask mask matches pointer index size (PR #69343)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 01:36:20 PDT 2023
================
@@ -26965,10 +26966,20 @@ to facilitate alias analysis and underlying-object detection.
Semantics:
""""""""""
-The result of ``ptrmask(ptr, mask)`` is equivalent to
-``getelementptr ptr, (ptrtoint(ptr) & mask) - ptrtoint(ptr)``. Both the returned
-pointer(s) and the first argument are based on the same underlying object (for more
-information on the *based on* terminology see
+The result of ``ptrmask(%ptr, %mask)`` is equivalent to the following expansion,
+where ``iPtrIdx`` is the index type size of the pointer::
+
+ %intptr = ptrtoint ptr %ptr to iPtrIdx ; this may truncate
+ %masked = and iPtrIdx %intptr, %mask
+ %diff = sub iPtrIdx %masked, %intptr
----------------
nikic wrote:
Done as part of https://github.com/llvm/llvm-project/pull/70015.
https://github.com/llvm/llvm-project/pull/69343
More information about the llvm-commits
mailing list