GEP subscript is interpreted as a signed value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-01-05 01:46:20 +00:00
parent ac8d27686d
commit 0d630d2204

View 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;
}