summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitfc1f2cd3e57eb62b3363a182da37da5e39a95c02 (patch)
tree50f8ed9ad6e4af1111461c9619dc907955c24575 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp
parentacb8becc735be3484f0abf5840a5db1b7797ebe6 (diff)
downloadbcm5719-llvm-fc1f2cd3e57eb62b3363a182da37da5e39a95c02.tar.gz
bcm5719-llvm-fc1f2cd3e57eb62b3363a182da37da5e39a95c02.zip
Fix regression in old-style JIT.
llvm-svn: 167057
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 99f6ec691ab..8e30a939bc1 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud