[llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM (original) (raw)
Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 17 23:49:47 PST 2019
- Previous message: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
- Next message: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 14, 2019 at 3:23 AM Juneyoung Lee via llvm-dev <llvm-dev at lists.llvm.org> wrote:
Patch https://reviews.llvm.org/D56598 adds llvm.psub(p1,p2) intrinsic function, which subtracts two pointers and returns the difference. Its semantic is as follows.
If p1 and p2 point to different objects, and neither of them is based on a pointer casted from an integer,
llvm.psub(p1, p2)
returns poison. For example,
Are you proposing landing this in conjunction with some of the other stuff discussed in the twin allocation paper? Otherwise isn't this problematic with propagateEquality of pointers?
a = malloc() free(a) b = malloc() // Assume b == a numerically if (a == b) { print(psub(b, b)) // prints 0 }
=>
a = malloc() free(a) b = malloc() // Assume b == a numerically if (a == b) { print(psub(a, b)) // prints poison }
Though I admit propagateEquality of pointers has many other problems like this.
-- Sanjoy
- Previous message: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
- Next message: [llvm-dev] Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]