[llvm] [LangRef] Do not make align imply dereferenceability (PR #158062)

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 07:04:39 PDT 2025


nunoplopes wrote:

Well int2ptr pointers are not well defined yet. But they must have multiple provenance as they have to alias with potentially multiple int2ptr that happened before.
I don't think we can restrict these pointers to access a single object. See this example:
```c
... = ptr2int %p
... = ptr2int %q
...

if (...) {
  %a = int2ptr %v
  store i8 0, %a
} else {
  %b = int2ptr %v
  %c = gep %b, 3
  store i8 0, %c
}

=>
%a = int2ptr %v
if (...) {
  store i8 0, %a
} else {
  %c = gep %a, 3
  store i8 0, %c
}
```

If %p/%q are consecutive objects, the accesses through %a and %c access different objects. But they both access through the same pointer in the optimized program (hoisting common instruction).

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


More information about the llvm-commits mailing list