Aaron Gray
2009-Jul-25 18:17 UTC
[LLVMdev] Bug in ExecutionEngine::getConstantValue() -- Instruction::PtrToInt
I think I might have found a bug in the exection engine's 'constants folding'. Basically APInt's parameters are the wrong way round. Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :- case Instruction::PtrToInt: { GenericValue GV = getConstantValue(Op0); uint32_t PtrWidth = TD->getPointerSizeInBits(); GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal)); return GV; } Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090725/db18ac2e/attachment.html>
John McCall
2009-Jul-25 18:48 UTC
[LLVMdev] Bug in ExecutionEngine::getConstantValue() -- Instruction::PtrToInt
Aaron Gray wrote:> I think I might have found a bug in the exection engine's 'constants > folding'. > > Basically APInt's parameters are the wrong way round. > > Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :- > > case Instruction::PtrToInt: { > GenericValue GV = getConstantValue(Op0); > uint32_t PtrWidth = TD->getPointerSizeInBits(); > GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal)); > return GV; > } > AaronThat looks to be the right order to me: APInt(unsigned numBits, uint64_t val, bool isSigned=false) John. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090725/ccc4b855/attachment.html>
Chris Lattner
2009-Jul-25 18:59 UTC
[LLVMdev] Bug in ExecutionEngine::getConstantValue() -- Instruction::PtrToInt
On Jul 25, 2009, at 11:17 AM, Aaron Gray wrote:> I think I might have found a bug in the exection engine's 'constants > folding'. > > Basically APInt's parameters are the wrong way round. > > Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :- > > case Instruction::PtrToInt: { > GenericValue GV = getConstantValue(Op0); > uint32_t PtrWidth = TD->getPointerSizeInBits(); > GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal)); > return GV; > }The code matches: APInt(unsigned numBits, uint64_t val, bool isSigned = false) which is correct. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090725/5e40fe23/attachment.html>
Aaron Gray
2009-Jul-25 19:03 UTC
[LLVMdev] Bug in ExecutionEngine::getConstantValue() -- Instruction::PtrToInt
2009/7/25 John McCall <rjmccall at apple.com>> Aaron Gray wrote: > > I think I might have found a bug in the exection engine's 'constants > folding'. > > Basically APInt's parameters are the wrong way round. > > Line 577 for lib/ExecutionEngine/ExecutionEngine.cpp :- > > case Instruction::PtrToInt: { > GenericValue GV = getConstantValue(Op0); > uint32_t PtrWidth = TD->getPointerSizeInBits(); > GV.IntVal = APInt(PtrWidth, uintptr_t(GV.PointerVal)); > return GV; > } > Aaron > > That looks to be the right order to me: > > APInt(unsigned numBits, uint64_t val, bool isSigned=false) >Ah I was reading the private version ! Whoopse ! Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090725/3329f2a1/attachment.html>