[PATCH] D114988: [IR] `GetElementPtrInst`: per-index `inrange` support

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 13:04:53 PDT 2022


efriedma added a comment.

> Could you clarify how the C standard guarantees this will return 1?

"Two pointers compare equal if [...] one is a pointer to one past the end of one array object and the other is a pointer to the start of a different array object that happens to immediately follow the first array object in the address space."

> I think the standard allows padding between struct members a and b (even though I see very little reason to add padding here)

The relevant rule says that if there isn't any padding, the pointers compare equal.  And we don't insert padding in practice.  It doesn't matter that some other compiler could theoretically add padding.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114988/new/

https://reviews.llvm.org/D114988



More information about the llvm-commits mailing list