summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/IntelJITEvents
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-12-15 04:45:43 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-12-15 04:45:43 +0000
commit48be28ef1a85f82b95e76313f5b8555d8dcf15ab (patch)
tree297ab6c6d17bb4bdc33524da52042b83dea36012 /llvm/lib/ExecutionEngine/IntelJITEvents
parent583b0762236e4241f140d07227e73ba9e3b65918 (diff)
downloadbcm5719-llvm-48be28ef1a85f82b95e76313f5b8555d8dcf15ab.tar.gz
bcm5719-llvm-48be28ef1a85f82b95e76313f5b8555d8dcf15ab.zip
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 llvm-svn: 224229
Diffstat (limited to 'llvm/lib/ExecutionEngine/IntelJITEvents')
-rw-r--r--llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
index c35e5244ecd..63a1b9ce8b5 100644
--- a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
+++ b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
@@ -149,6 +149,18 @@ void IntelJITEventListener::NotifyObjectEmitted(
FunctionMessage.line_number_size = 0;
FunctionMessage.line_number_table = 0;
} else {
+ // Source line information for the address range is provided as
+ // a code offset for the start of the corresponding sub-range and
+ // a source line. JIT API treats offsets in LineNumberInfo structures
+ // as the end of the corresponding code region. The start of the code
+ // is taken from the previous element. Need to shift the elements.
+
+ LineNumberInfo last = LineInfo.back();
+ last.Offset = FunctionMessage.method_size;
+ LineInfo.push_back(last);
+ for (size_t i = LineInfo.size() - 2; i > 0; --i)
+ LineInfo[i].LineNumber = LineInfo[i - 1].LineNumber;
+
SourceFileName = Lines.front().second.FileName;
FunctionMessage.source_file_name = const_cast<char *>(SourceFileName.c_str());
FunctionMessage.line_number_size = LineInfo.size();
OpenPOWER on IntegriCloud