Skip to content

Commit

Permalink
Fix regression in old-style JIT.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167057 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
eefriedman committed Oct 30, 2012
1 parent 4c74a95 commit bbc6e67
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/ExecutionEngine/ExecutionEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,19 +645,17 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
}
case Instruction::PtrToInt: {
GenericValue GV = getConstantValue(Op0);
assert(CE->getOperand(1)->getType()->isPointerTy() &&
"Must be a pointer type!");
uint32_t PtrWidth = TD->getTypeSizeInBits(CE->getOperand(1)->getType());
uint32_t PtrWidth = TD->getTypeSizeInBits(Op0->getType());
assert(PtrWidth <= 64 && "Bad pointer width");
GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal));
uint32_t IntWidth = TD->getTypeSizeInBits(CE->getType());
GV.IntVal = GV.IntVal.zextOrTrunc(IntWidth);
return GV;
}
case Instruction::IntToPtr: {
GenericValue GV = getConstantValue(Op0);
assert(CE->getOperand(1)->getType()->isPointerTy() &&
"Must be a pointer type!");
uint32_t PtrWidth = TD->getTypeSizeInBits(CE->getType());
if (PtrWidth != GV.IntVal.getBitWidth())
GV.IntVal = GV.IntVal.zextOrTrunc(PtrWidth);
GV.IntVal = GV.IntVal.zextOrTrunc(PtrWidth);
assert(GV.IntVal.getBitWidth() <= 64 && "Bad pointer width");
GV.PointerVal = PointerTy(uintptr_t(GV.IntVal.getZExtValue()));
return GV;
Expand Down

0 comments on commit bbc6e67

Please sign in to comment.