From: Adrian Prantl Date: Mon, 22 May 2017 18:50:12 +0000 (+0000) Subject: Revert "Don't generate line&scope debug info for meta-instructions." X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=334a130a6f95d37b0792320cbfdc3386523777a1;p=platform%2Fupstream%2Fllvm.git Revert "Don't generate line&scope debug info for meta-instructions." This reverts commit r303566 while investigating a stage2 buildbot failure. llvm-svn: 303570 --- diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index 8d040be..e7e728c 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -826,35 +826,26 @@ public: getOperand(0).getSubReg() == getOperand(1).getSubReg(); } - /// Return true if this instruction doesn't produce any output in the form of - /// executable instructions. - bool isMetaInstruction() const { - switch (getOpcode()) { - default: - return false; - case TargetOpcode::IMPLICIT_DEF: - case TargetOpcode::KILL: - case TargetOpcode::CFI_INSTRUCTION: - case TargetOpcode::EH_LABEL: - case TargetOpcode::GC_LABEL: - case TargetOpcode::DBG_VALUE: - return true; - } - } - - /// Return true if this is a transient instruction that is either very likely - /// to be eliminated during register allocation (such as copy-like - /// instructions), or if this instruction doesn't have an execution-time cost. + /// Return true if this is a transient instruction that is + /// either very likely to be eliminated during register allocation (such as + /// copy-like instructions), or if this instruction doesn't have an + /// execution-time cost. bool isTransient() const { - switch (getOpcode()) { - default: - return isMetaInstruction(); + switch(getOpcode()) { + default: return false; // Copy-like instructions are usually eliminated during register allocation. case TargetOpcode::PHI: case TargetOpcode::COPY: case TargetOpcode::INSERT_SUBREG: case TargetOpcode::SUBREG_TO_REG: case TargetOpcode::REG_SEQUENCE: + // Pseudo-instructions that don't produce any real output. + case TargetOpcode::IMPLICIT_DEF: + case TargetOpcode::KILL: + case TargetOpcode::CFI_INSTRUCTION: + case TargetOpcode::EH_LABEL: + case TargetOpcode::GC_LABEL: + case TargetOpcode::DBG_VALUE: return true; } } diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 8815310..1b39e46 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1025,11 +1025,11 @@ void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) { bool EmptyPrologue = true; for (const auto &MBB : *MF) { for (const auto &MI : MBB) { - if (!MI.isMetaInstruction() && !MI.getFlag(MachineInstr::FrameSetup) && + if (!MI.isDebugValue() && !MI.getFlag(MachineInstr::FrameSetup) && MI.getDebugLoc()) { PrologEndLoc = MI.getDebugLoc(); break; - } else if (!MI.isMetaInstruction()) { + } else if (!MI.isDebugValue()) { EmptyPrologue = false; } } diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index 27ae77b..826162a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -223,9 +223,9 @@ void DebugHandlerBase::endInstruction() { return; assert(CurMI != nullptr); - // Don't create a new label after DBG_VALUE and other instructions that don't - // generate code. - if (!CurMI->isMetaInstruction()) { + // Don't create a new label after DBG_VALUE instructions. + // They don't generate code. + if (!CurMI->isDebugValue()) { PrevLabel = nullptr; PrevInstBB = CurMI->getParent(); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 8fb3db2..3410b98 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1029,7 +1029,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) { assert(CurMI); // Check if source location changes, but ignore DBG_VALUE and CFI locations. - if (MI->isMetaInstruction()) + if (MI->isDebugValue() || MI->isCFIInstruction()) return; const DebugLoc &DL = MI->getDebugLoc(); // When we emit a line-0 record, we don't update PrevInstLoc; so look at @@ -1111,7 +1111,7 @@ static DebugLoc findPrologueEndLoc(const MachineFunction *MF) { // the beginning of the function body. for (const auto &MBB : *MF) for (const auto &MI : MBB) - if (!MI.isMetaInstruction() && !MI.getFlag(MachineInstr::FrameSetup) && + if (!MI.isDebugValue() && !MI.getFlag(MachineInstr::FrameSetup) && MI.getDebugLoc()) return MI.getDebugLoc(); return DebugLoc(); diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp index 40ee7ea..275d84e 100644 --- a/llvm/lib/CodeGen/LexicalScopes.cpp +++ b/llvm/lib/CodeGen/LexicalScopes.cpp @@ -86,9 +86,8 @@ void LexicalScopes::extractLexicalScopes( continue; } - // Ignore DBG_VALUE and similar instruction that do not contribute to any - // instruction in the output. - if (MInsn.isMetaInstruction()) + // Ignore DBG_VALUE. It does not contribute to any instruction in output. + if (MInsn.isDebugValue()) continue; if (RangeBeginMI) { diff --git a/llvm/test/DebugInfo/MIR/X86/empty-inline.mir b/llvm/test/DebugInfo/MIR/X86/empty-inline.mir deleted file mode 100644 index 1766a8f..0000000 --- a/llvm/test/DebugInfo/MIR/X86/empty-inline.mir +++ /dev/null @@ -1,122 +0,0 @@ -# RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s -# -# This testcase has an implicit def pseudo-iunstruction with a debug location. -# -# CHECK: .debug_info contents: -# CHECK: DW_TAG_subprogram -# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) -# CHECK-NOT: DW_TAG -# CHECK: DW_AT_specification {{.*}} "_ZN1C5m_fn3Ev" -# CHECK-NOT: DW_TAG -# Here should not be an inlined subroutine with 0 length. -# CHECK: NULL -# -# CHECK: Address Line Column File ISA Discriminator Flags -# CHECK-NEXT: --- -# CHECK-NEXT: 25 0 1 0 0 is_stmt -# CHECK-NEXT: 29 28 1 0 0 is_stmt prologue_end -# CHECK-NEXT: 29 28 1 0 0 is_stmt end_sequence ---- | - source_filename = "t.ll" - target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - target triple = "x86_64-apple-macosx" - - %class.E = type { %class.D } - %class.D = type { %class.B } - %class.B = type { %class.A, %class.A } - %class.A = type { i8 } - %class.C = type <{ %class.E*, %class.B, [2 x i8] }> - - @a = local_unnamed_addr global %class.E* null, align 4 - - define i32 @_ZN1C5m_fn3Ev(%class.C* nocapture) local_unnamed_addr align 2 !dbg !6 { - %2 = alloca %class.B, align 1 - %3 = load %class.E*, %class.E** @a, align 4 - %4 = icmp eq %class.E* %3, null - br i1 %4, label %10, label %5 - - ;