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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 11:58:54 PDT 2018


ABataev created this revision.
ABataev added reviewers: tra, jlebar, echristo.
Herald added a subscriber: jholewinski.

Initial function labels must follow the debug location for the correct relocation info generation.


Repository:
  rL LLVM

https://reviews.llvm.org/D45784

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


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.142977.patch
Type: text/x-patch
Size: 1593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180418/81dee88d/attachment.bin>


More information about the llvm-commits mailing list