[llvm] r340122 - [DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.

Hsiangkai Wang via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 18 07:55:35 PDT 2018


Author: hsiangkai
Date: Sat Aug 18 07:55:34 2018
New Revision: 340122

URL: http://llvm.org/viewvc/llvm-project?rev=340122&view=rev
Log:
[DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.

Convert llvm.dbg.label(!label_metadata) to DBG_LABEL !label_metadata.

Differential Revision: https://reviews.llvm.org/D50622

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
    llvm/trunk/test/DebugInfo/Generic/debug-label-mi.ll
    llvm/trunk/test/DebugInfo/Generic/debug-label-opt.ll
    llvm/trunk/test/DebugInfo/Generic/debug-label.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=340122&r1=340121&r2=340122&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Sat Aug 18 07:55:34 2018
@@ -1426,6 +1426,18 @@ bool FastISel::selectIntrinsicCall(const
     }
     return true;
   }
+  case Intrinsic::dbg_label: {
+    const DbgLabelInst *DI = cast<DbgLabelInst>(II);
+    assert(DI->getLabel() && "Missing label");
+    if (!FuncInfo.MF->getMMI().hasDebugInfo()) {
+      LLVM_DEBUG(dbgs() << "Dropping debug info for " << *DI << "\n");
+      return true;
+    }
+
+    BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
+            TII.get(TargetOpcode::DBG_LABEL)).addMetadata(DI->getLabel());
+    return true;
+  }
   case Intrinsic::objectsize: {
     ConstantInt *CI = cast<ConstantInt>(II->getArgOperand(1));
     unsigned long long Res = CI->isZero() ? -1ULL : 0;

Modified: llvm/trunk/test/DebugInfo/Generic/debug-label-mi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/debug-label-mi.ll?rev=340122&r1=340121&r2=340122&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/debug-label-mi.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/debug-label-mi.ll Sat Aug 18 07:55:34 2018
@@ -1,12 +1,12 @@
 ; Test DBG_LABEL MachineInstr for label debugging.
 ; REQUIRES: asserts
-; RUN: llc -fast-isel=false -debug-only=isel %s -o /dev/null 2> %t.debug
+; RUN: llc -debug-only=isel %s -o /dev/null 2> %t.debug
 ; RUN: cat %t.debug | FileCheck %s --check-prefix=CHECKMI
 ;
 ; CHECKMI: DBG_LABEL "top", debug-location !9
 ; CHECKMI: DBG_LABEL "done", debug-location !11
 ;
-; RUN: llc -fast-isel=false %s -o - | FileCheck %s --check-prefix=CHECKASM
+; RUN: llc %s -o - | FileCheck %s --check-prefix=CHECKASM
 ;
 ; CHECKASM: DEBUG_LABEL: foo:top
 ; CHECKASM: DEBUG_LABEL: foo:done

Modified: llvm/trunk/test/DebugInfo/Generic/debug-label-opt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/debug-label-opt.ll?rev=340122&r1=340121&r2=340122&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/debug-label-opt.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/debug-label-opt.ll Sat Aug 18 07:55:34 2018
@@ -1,7 +1,7 @@
 ; Test DBG_LABEL MachineInstr under optimization.
 ; The test case is generated by clang with -O2 is on.
 ; REQUIRES: asserts
-; RUN: llc -fast-isel=false -debug-only=isel %s -o /dev/null 2> %t.debug
+; RUN: llc -debug-only=isel %s -o /dev/null 2> %t.debug
 ; RUN: cat %t.debug | FileCheck %s --check-prefix=CHECKMI
 ;
 ; CHECKMI: DBG_LABEL "end_sum", debug-location !17

Modified: llvm/trunk/test/DebugInfo/Generic/debug-label.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/debug-label.ll?rev=340122&r1=340121&r2=340122&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/debug-label.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/debug-label.ll Sat Aug 18 07:55:34 2018
@@ -1,4 +1,4 @@
-; RUN: llc -fast-isel=false -O0 -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s
+; RUN: llc -O0 -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s
 ;
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_label
@@ -12,7 +12,7 @@
 ; CHECK-NEXT: DW_AT_decl_line [DW_FORM_data1] {{.*}}7
 ; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] {{.*}}{{0x[0-9a-f]+}}
 ;
-; RUN: llc -fast-isel=false -O0 -o - %s | FileCheck %s -check-prefix=ASM
+; RUN: llc -O0 -o - %s | FileCheck %s -check-prefix=ASM
 ;
 ; ASM: [[TOP_LOW_PC:[.0-9a-zA-Z]+]]:{{[[:space:]].*}}DEBUG_LABEL: foo:top
 ; ASM: [[DONE_LOW_PC:[.0-9a-zA-Z]+]]:{{[[:space:]].*}}DEBUG_LABEL: foo:done




More information about the llvm-commits mailing list