GEP subscript is interpreted as a signed value.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 5 Jan 2007 01:46:20 +0000 (01:46 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 5 Jan 2007 01:46:20 +0000 (01:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32888 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index f4fe873f9fbe50ee6fc293a6c45c8366fe0c4a66..d8d862d709872cff6a98706c7269e81e85915583 100644 (file)
@@ -1703,7 +1703,7 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
       if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) {
         if (CI->getZExtValue() == 0) continue;
         uint64_t Offs = 
-            TD->getTypeSize(Ty)*cast<ConstantInt>(CI)->getZExtValue();
+            TD->getTypeSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
         N = DAG.getNode(ISD::ADD, N.getValueType(), N, getIntPtrConstant(Offs));
         continue;
       }