llvm.org GIT mirror llvm / 0bf492d
Fix line mapping information in LLVM JIT profiling with Vtune The line mapping information for dynamic code is reported incorrectly. It causes VTune to map LLVM generated code to source lines incorrectly. This patch fix this issue. Patch by Denis Pravdin. Differential Revision: http://reviews.llvm.org/D6603 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224229 91177308-0d34-0410-b5e6-96231b3b80d8 Alexey Bataev 5 years ago
2 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
148148 FunctionMessage.line_number_size = 0;
149149 FunctionMessage.line_number_table = 0;
150150 } else {
151 // Source line information for the address range is provided as
152 // a code offset for the start of the corresponding sub-range and
153 // a source line. JIT API treats offsets in LineNumberInfo structures
154 // as the end of the corresponding code region. The start of the code
155 // is taken from the previous element. Need to shift the elements.
156
157 LineNumberInfo last = LineInfo.back();
158 last.Offset = FunctionMessage.method_size;
159 LineInfo.push_back(last);
160 for (size_t i = LineInfo.size() - 2; i > 0; --i)
161 LineInfo[i].LineNumber = LineInfo[i - 1].LineNumber;
162
151163 SourceFileName = Lines.front().second.FileName;
152164 FunctionMessage.source_file_name = const_cast(SourceFileName.c_str());
153165 FunctionMessage.line_number_size = LineInfo.size();
139139 TheJIT.reset(EngineBuilder(std::move(TheModule))
140140 .setEngineKind(EngineKind::JIT)
141141 .setErrorStr(&Error)
142 .setMCJITMemoryManager(MemMgr)
142 .setMCJITMemoryManager(std::unique_ptr(MemMgr))
143143 .create());
144144 if (Error.empty() == false)
145145 errs() << Error;