summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/ExecutionEngine.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-10-30 22:21:55 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-10-30 22:21:55 +0000
commitbbc6e671b1a902c96aff152cc524a5ee6e253907 (patch)
tree527c44b89440d383f3fcb0563f6d898f2bd95f09 /lib/ExecutionEngine/ExecutionEngine.cpp
parent4c74a956b2621bb7bb1df0b2f7571060eb095464 (diff)
downloadllvm-bbc6e671b1a902c96aff152cc524a5ee6e253907.tar.gz
llvm-bbc6e671b1a902c96aff152cc524a5ee6e253907.tar.bz2
llvm-bbc6e671b1a902c96aff152cc524a5ee6e253907.tar.xz
Fix regression in old-style JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 99f6ec691a..8e30a939bc 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -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;