diff options
Diffstat (limited to 'lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r-- | lldb/source/Expression/IRInterpreter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index a2b0c5b8685..29c6742fa87 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -33,6 +33,7 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include "llvm/IR/Operator.h" #include "llvm/Support/raw_ostream.h" #include <map> @@ -297,7 +298,8 @@ public: SmallVector <Value *, 8> indices (op_cursor, op_end); - uint64_t offset = m_target_data.getIndexedOffset(base->getType(), indices); + Type *src_elem_ty = cast<GEPOperator>(constant_expr)->getSourceElementType(); + uint64_t offset = m_target_data.getIndexedOffsetInType(src_elem_ty, indices); const bool is_signed = true; value += APInt(value.getBitWidth(), offset, is_signed); @@ -999,7 +1001,7 @@ IRInterpreter::Interpret (llvm::Module &module, } const Value *pointer_operand = gep_inst->getPointerOperand(); - Type *pointer_type = pointer_operand->getType(); + Type *src_elem_ty = gep_inst->getSourceElementType(); lldb_private::Scalar P; @@ -1048,7 +1050,7 @@ IRInterpreter::Interpret (llvm::Module &module, const_indices.push_back(constant_index); } - uint64_t offset = data_layout.getIndexedOffset(pointer_type, const_indices); + uint64_t offset = data_layout.getIndexedOffsetInType(src_elem_ty, const_indices); lldb_private::Scalar Poffset = P + offset; |