[PATCH] D38557: Convert an APInt to int64_t properly in TTI::getGEPCost().

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 13:00:54 PDT 2017


efriedma added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:726
+            ? std::numeric_limits<int64_t>::max()
+            : BaseOffset.getSExtValue();
     if (static_cast<T *>(this)->isLegalAddressingMode(
----------------
This doesn't actually clamp the way you want it to; suppose BaseOffset is less than int64_t::min.

I'd suggest just BaseOffset.sextOrTrunc(64).getSExtValue(); not precisely the same thing, but good enough until someone comes along with an architecture which actually needs 128-bit pointer offsets.


https://reviews.llvm.org/D38557





More information about the llvm-commits mailing list