[llvm-commits] [llvm] r167057 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Oct 30 15:21:55 PDT 2012
Author: efriedma
Date: Tue Oct 30 17:21:55 2012
New Revision: 167057
URL: http://llvm.org/viewvc/llvm-project?rev=167057&view=rev
Log:
Fix regression in old-style JIT.
Modified:
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=167057&r1=167056&r2=167057&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Oct 30 17:21:55 2012
@@ -645,19 +645,17 @@
}
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;
More information about the llvm-commits
mailing list