Eliminated the MemAccessInst class, folding contents into GEP class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3487 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 7b5a63e..8bd6774 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -769,14 +769,14 @@
// the offset that arguments ArgOff+1 -> NumArgs specify for the pointer type
// specified by argument Arg.
//
-static PointerTy getElementOffset(MemAccessInst &I, ExecutionContext &SF) {
+static PointerTy getElementOffset(GetElementPtrInst &I, ExecutionContext &SF) {
assert(isa<PointerType>(I.getPointerOperand()->getType()) &&
"Cannot getElementOffset of a nonpointer type!");
PointerTy Total = 0;
const Type *Ty = I.getPointerOperand()->getType();
- unsigned ArgOff = I.getFirstIndexOperandNumber();
+ unsigned ArgOff = 1;
while (ArgOff < I.getNumOperands()) {
if (const StructType *STy = dyn_cast<StructType>(Ty)) {
const StructLayout *SLO = TD.getStructLayout(STy);
@@ -806,8 +806,7 @@
if (Idx >= AT->getNumElements() && ArrayChecksEnabled) {
cerr << "Out of range memory access to element #" << Idx
<< " of a " << AT->getNumElements() << " element array."
- << " Subscript #" << (ArgOff-I.getFirstIndexOperandNumber())
- << "\n";
+ << " Subscript #" << (ArgOff-1) << "\n";
// Get outta here!!!
siglongjmp(SignalRecoverBuffer, SIGTRAP);
}