[PATCH] D90708: [LangRef] Clarify GEP inbounds wrapping semantics

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 18:18:20 PST 2020


aqjune added a comment.

> However, I do wonder if we could get away with saying that no allocated object may wrap the signed address space, in which case inbounds would just map cleanly to nsw, which would both allow more optimization and be easier to reason about. We have at least one important target (x86-64) where this is a given by hardware constraints. But I don't know if we can get away with making that a general limitation. (I don't think it's a good idea to make core GEP semantics target-dependent.)

It seems sbrk() assume an address space is unsigned:
https://code.woboq.org/userspace/glibc/misc/sbrk.c.html

Since it is frequently used to implement malloc(), I guess malloc can in general return an allocation whose address is something like [0x7fffffff, 0x80000001]. Does this make sense?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90708



More information about the llvm-commits mailing list