[llvm] LangRef: allocated objects can grow (PR #141338)

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Sat May 24 05:03:52 PDT 2025


================
@@ -11870,6 +11879,8 @@ if the ``getelementptr`` has any non-zero indices, the following rules apply:
    :ref:`based <pointeraliasing>` on. This means that it points into that
    allocated object, or to its end. Note that the object does not have to be
    live anymore; being in-bounds of a deallocated object is sufficient.
+   If the allocated object can grow, then the relevant size for being *in
+   bounds* is the maximal size the object will ever have, not its current size.
----------------
nunoplopes wrote:

> > This has implications in alias analysis. We would need to disable all rules that use reasoning such as `p + offset > p's size` to conclude no-alias, because the size may be increased later. We have a few of these rules in BasicAA.
> 
> This alias analysis only applies to fixed size objects with known size. I do not believe it will be affected by this change (which is only relevant to allocations which for LLVM does not know the size).

Alias analysis works over heap-allocated objects. Anything that LLVM (MemoryBuiltins.h) can infer the size is fair game.

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


More information about the llvm-commits mailing list