[PATCH] D38499: [BasicAA] Fix adjustToPointerSize in BasicAliasAnalysis.cpp for ptr > 64b

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 11:41:58 PDT 2017


efriedma added a comment.

> In my use case, I have 128-bit pointers but "adding" to one of these will only ever modify the lower 64 bits. So for my use case, offsets > 64 bits just don't matter.

That's completely different.

LangRef says "[...] the offsets are added to the base address with silently-wrapping two’s complement arithmetic.  If the offsets have a different width from the pointer, they are sign-extended or truncated to the width of the pointer."  And we have a bunch of code which actually assumes it represents two's complement arithmetic in the width of the pointer; for example, instcombine has a transform which turns a pointer comparison into a comparison of pointer offsets, and some analysis passes use an APInt whose width is the pointer width rather than the int64_t AA uses.  If pointer arithmetic wraps differently on your target, we probably need to add an attribute to the data layout, and adjust LangRef to define what it means.


https://reviews.llvm.org/D38499





More information about the llvm-commits mailing list