[PATCH] D38501: [ValueTracking] Fix a misuse of APInt in GetPointerBaseWithConstantOffset
Michael Ferguson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 07:52:01 PDT 2017
mppf added inline comments.
================
Comment at: lib/Analysis/ValueTracking.cpp:3081
}
Offset = ByteOffset.getSExtValue();
return Ptr;
----------------
hfinkel wrote:
> Do we need to add a check here that the offset can actually be represented in 64 bits? I don't think that a truncated return value here actually makes sense.
>
getSExtValue does make sure it can be represented in an int64_t. If you were talking about using sextOrTrunc above, I think we need that truncation so that we can handle overflow in GEP operations so that we can handle negative GEP offsets correctly. (see my recent comment in D38499).
https://reviews.llvm.org/D38501
More information about the llvm-commits
mailing list