[PATCH] D45784: [DEBUG_INFO, NVPTX] Fix relocation info.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 06:49:56 PDT 2018


ABataev updated this revision to Diff 157679.
ABataev added a comment.

Updated to the latest revision.


Repository:
  rL LLVM

https://reviews.llvm.org/D45784

Files:
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  test/DebugInfo/NVPTX/cu-range-hole.ll
  test/DebugInfo/NVPTX/debug-loc-offset.ll


Index: test/DebugInfo/NVPTX/debug-loc-offset.ll
===================================================================
--- test/DebugInfo/NVPTX/debug-loc-offset.ll
+++ test/DebugInfo/NVPTX/debug-loc-offset.ll
@@ -11,8 +11,8 @@
 
 ; CHECK: .visible .func  (.param .b32 func_retval0) _Z3bari(
 ; CHECK: {
-; CHECK: Lfunc_begin0:
 ; CHECK: .loc [[CU1:[0-9]+]] 1 0
+; CHECK: Lfunc_begin0:
 
 ; CHECK: //DEBUG_VALUE: bar:b <- {{[0-9]+}}
 ; CHECK: //DEBUG_VALUE: bar:b <- {{[0-9]+}}
@@ -39,8 +39,8 @@
 
 ; CHECK: .visible .func _Z3baz1A(
 ; CHECK: {
-; CHECK: Lfunc_begin1:
 ; CHECK: .loc [[CU2:[0-9]+]] 6 0
+; CHECK: Lfunc_begin1:
 ; CHECK: //DEBUG_VALUE: baz:z <- {{[0-9]+}}
 ; CHECK: //DEBUG_VALUE: baz:z <- {{[0-9]+}}
 ; CHECK: .loc [[CU2]] 10 0
Index: test/DebugInfo/NVPTX/cu-range-hole.ll
===================================================================
--- test/DebugInfo/NVPTX/cu-range-hole.ll
+++ test/DebugInfo/NVPTX/cu-range-hole.ll
@@ -6,8 +6,8 @@
 ; CHECK: .param .b32 b_param_0
 ; CHECK: )
 ; CHECK: {
-; CHECK: Lfunc_begin0:
 ; CHECK: .loc 1 1 0
+; CHECK: Lfunc_begin0:
 ; CHECK: .loc 1 1 0
 ; CHECK: ret;
 ; CHECK: Lfunc_end0:
@@ -27,6 +27,7 @@
 ; CHECK: .param .b32 d_param_0
 ; CHECK: )
 ; CHECK: {
+; CHECK: .loc 1 3 0
 ; CHECK: Lfunc_begin2:
 ; CHECK: .loc 1 3 0
 ; CHECK: ret;
Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -695,7 +695,7 @@
     OutStreamer->EmitLabel(DeadBlockSyms[i]);
   }
 
-  if (CurrentFnBegin) {
+  if (CurrentFnBegin && !MF->getTarget().getTargetTriple().isNVPTX()) {
     if (MAI->useAssignmentForEHBegin()) {
       MCSymbol *CurPos = OutContext.createTempSymbol();
       OutStreamer->EmitLabel(CurPos);
@@ -713,6 +713,13 @@
     HI.Handler->beginFunction(MF);
   }
 
+  // For NVPTX target initial function labels must follow the debug location for
+  // the correct relocation info generation.
+  if (CurrentFnBegin && MF->getTarget().getTargetTriple().isNVPTX()) {
+    assert(!MAI->useAssignmentForEHBegin() && "EH is not supported for NVPTX.");
+    OutStreamer->EmitLabel(CurrentFnBegin);
+  }
+
   // Emit the prologue data.
   if (F.hasPrologueData())
     EmitGlobalConstant(F.getParent()->getDataLayout(), F.getPrologueData());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45784.157679.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180727/f8655bc2/attachment.bin>


More information about the llvm-commits mailing list