Hi all, While testing my compiler on win32 in JIT mode, I ran into a couple of issues: 1. I linked the compiler with the lib files resulting from the cmake created VS.NET build. While everything built just fine, the ExecutionEngine::create call always returned NULL. The fix was to also link with JIT.obj (thanks aKor for pointing me in the right direction). I would have thought that linking with LLVMJIT.lib should suffice... a VC++ linker issue? 2. There seems to be an issue in ScheduleDAGSDNodes.h when in debug mode. The problem is the evaluation of "&SUnits[0];" which ASSERT's in VC++'s vector[] implementation (when _HAS_ITERATOR_DEBUGGING is on). As a work-around, I commented out the debug code (see "patch" below.) What would the proper solution be? The idiom appears to be allowed by the C++03 standard, but at least VC++ 2008 Express Edition with _HAS_ITERATOR_DEBUGGING fails. Best regards, Stein Roger Index: include/llvm/CodeGen/ScheduleDAGSDNodes.h ==================================================================--- include/llvm/CodeGen/ScheduleDAGSDNodes.h (revision 61500) +++ include/llvm/CodeGen/ScheduleDAGSDNodes.h (working copy) @@ -103,10 +103,10 @@ /// SUnit *NewSUnit(SDNode *N) { #ifndef NDEBUG - const SUnit *Addr = &SUnits[0]; + //const SUnit *Addr = &SUnits[0]; #endif SUnits.push_back(SUnit(N, (unsigned)SUnits.size())); - assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!"); + //assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on the fly!"); SUnits.back().OrigNode = &SUnits.back(); return &SUnits.back(); }
Óscar Fuentes
2008-Dec-31 01:19 UTC
[LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
srs <skaflotten at gmail.com> writes:> While testing my compiler on win32 in JIT mode, I ran into a couple of > issues: > > 1. I linked the compiler with the lib files resulting from the cmake > created VS.NET build. While everything built just fine, the > ExecutionEngine::create call always returned NULL. The fix was to also > link with JIT.obj (thanks aKor for pointing me in the right direction). > I would have thought that linking with LLVMJIT.lib should suffice... a > VC++ linker issue?Try adding this to the link command of your executable: /INCLUDE:_X86TargetMachineModule I should document this somehow. [snip] -- Oscar
>> While testing my compiler on win32 in JIT mode, I ran into a couple of >> issues: >> >> 1. I linked the compiler with the lib files resulting from the cmake >> created VS.NET build. While everything built just fine, the >> ExecutionEngine::create call always returned NULL. The fix was to also >> link with JIT.obj (thanks aKor for pointing me in the right direction). >> I would have thought that linking with LLVMJIT.lib should suffice... a >> VC++ linker issue? >> > > Try adding this to the link command of your executable: > > /INCLUDE:_X86TargetMachineModule > > I should document this somehow. >Yeah, this is necessary, but not sufficient. I also had to link with ExecutionEngineBindings.obj (not JIT.obj as first stated) /Stein Roger
Bill Wendling
2008-Dec-31 09:26 UTC
[LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
On Dec 30, 2008, at 4:51 PM, srs wrote:> 2. There seems to be an issue in ScheduleDAGSDNodes.h when in debug > mode. The problem is the evaluation of "&SUnits[0];" which ASSERT's in > VC++'s vector[] implementation (when _HAS_ITERATOR_DEBUGGING is on). > > As a work-around, I commented out the debug code (see "patch" below.) > > What would the proper solution be? The idiom appears to be allowed by > the C++03 standard, but at least VC++ 2008 Express Edition with > _HAS_ITERATOR_DEBUGGING fails. >What is the assertion message? -bw> Index: include/llvm/CodeGen/ScheduleDAGSDNodes.h > ==================================================================> --- include/llvm/CodeGen/ScheduleDAGSDNodes.h (revision 61500) > +++ include/llvm/CodeGen/ScheduleDAGSDNodes.h (working copy) > @@ -103,10 +103,10 @@ > /// > SUnit *NewSUnit(SDNode *N) { > #ifndef NDEBUG > - const SUnit *Addr = &SUnits[0]; > + //const SUnit *Addr = &SUnits[0]; > #endif > SUnits.push_back(SUnit(N, (unsigned)SUnits.size())); > - assert(Addr == &SUnits[0] && "SUnits std::vector reallocated on > the fly!"); > + //assert(Addr == &SUnits[0] && "SUnits std::vector > reallocated on > the fly!"); > SUnits.back().OrigNode = &SUnits.back(); > return &SUnits.back(); > }
Bill Wendling wrote:> On Dec 30, 2008, at 4:51 PM, srs wrote: > > >> 2. There seems to be an issue in ScheduleDAGSDNodes.h when in debug >> mode. The problem is the evaluation of "&SUnits[0];" which ASSERT's in >> VC++'s vector[] implementation (when _HAS_ITERATOR_DEBUGGING is on). >> >> As a work-around, I commented out the debug code (see "patch" below.) >> >> What would the proper solution be? The idiom appears to be allowed by >> the C++03 standard, but at least VC++ 2008 Express Edition with >> _HAS_ITERATOR_DEBUGGING fails. >> >> > What is the assertion message? > > -bw >"vector subscript out of range" This is the asserting code from <vector> : const_reference operator[](size_type _Pos) const { // subscript nonmutable sequence #if _HAS_ITERATOR_DEBUGGING if (size() <= _Pos) { _DEBUG_ERROR("vector subscript out of range"); _SCL_SECURE_OUT_OF_RANGE; } #endif /* _HAS_ITERATOR_DEBUGGING */ _SCL_SECURE_VALIDATE_RANGE(_Pos < size()); return (*(_Myfirst + _Pos)); } /Stein Roger
Maybe Matching Threads
- [LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
- [LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
- [LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
- [LLVMdev] Win32 JIT issue + bug in ScheduleDAGSNodes.h?
- [LLVMdev] Suspicious code in backend scheduler