[PATCH] D38337: Check for overflows when calculating the offset in GetGEPCost.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 16:04:27 PDT 2017


efriedma added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:707
+          BaseOffset +=
+              APInt(PtrSizeBits, ConstIdx->getSExtValue()) * ElementSize;
+        } else {
----------------
`ConstIdx->getValue().sextOrTrunc(PtrSizeBits)`?  getSExtValue() can fail if ConstIdx is, for example, an i128.


https://reviews.llvm.org/D38337





More information about the llvm-commits mailing list