--- ValueTracking.cpp	2018-01-30 01:57:17.000000000 -0800
+++ llvm/lib/Analysis/ValueTracking.cpp	2018-03-19 13:04:03.444216231 -0700
@@ -3108,7 +3108,7 @@
       if (!GEP->accumulateConstantOffset(DL, GEPOffset))
         break;

-      ByteOffset += GEPOffset.getSExtValue();
+      ByteOffset += GEPOffset.sextOrTrunc(ByteOffset.getBitWidth());

       Ptr = GEP->getPointerOperand();
     } else if (Operator::getOpcode(Ptr) == Instruction::BitCast ||
