[llvm] r325297 - [Debugify] Don't check functions which were skipped

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 13:28:38 PST 2018


Author: vedantk
Date: Thu Feb 15 13:28:38 2018
New Revision: 325297

URL: http://llvm.org/viewvc/llvm-project?rev=325297&view=rev
Log:
[Debugify] Don't check functions which were skipped

If no debug info was applied to a function, its debug info shouldn't be
checked (it doesn't have any :).

Modified:
    llvm/trunk/test/DebugInfo/debugify.ll
    llvm/trunk/tools/opt/Debugify.cpp

Modified: llvm/trunk/test/DebugInfo/debugify.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/debugify.ll?rev=325297&r1=325296&r2=325297&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/debugify.ll (original)
+++ llvm/trunk/test/DebugInfo/debugify.ll Thu Feb 15 13:28:38 2018
@@ -19,6 +19,8 @@
 ; RUN: opt -enable-debugify -strip -S -o - < %s | \
 ; RUN:   FileCheck %s -check-prefix=CHECK-FAIL
 
+; RUN: opt -enable-debugify -S -o - < %s | FileCheck %s -check-prefix=PASS
+
 ; CHECK-LABEL: define void @foo
 define void @foo() {
 ; CHECK: ret void, !dbg ![[RET1:.*]]
@@ -79,3 +81,5 @@ define weak_odr zeroext i1 @baz() {
 ; CHECK-FAIL: WARNING: Missing line 4
 ; CHECK-FAIL: ERROR: Missing variable 1
 ; CHECK-FAIL: CheckDebugify: FAIL
+
+; PASS: CheckDebugify: PASS

Modified: llvm/trunk/tools/opt/Debugify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Debugify.cpp?rev=325297&r1=325296&r2=325297&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Debugify.cpp (original)
+++ llvm/trunk/tools/opt/Debugify.cpp Thu Feb 15 13:28:38 2018
@@ -35,6 +35,10 @@ using namespace llvm;
 
 namespace {
 
+bool isFunctionSkipped(Function &F) {
+  return F.isDeclaration() || !F.hasExactDefinition();
+}
+
 bool applyDebugifyMetadata(Module &M) {
   // Skip modules with debug info.
   if (M.getNamedMetadata("llvm.dbg.cu")) {
@@ -67,7 +71,7 @@ bool applyDebugifyMetadata(Module &M) {
 
   // Visit each instruction.
   for (Function &F : M) {
-    if (F.isDeclaration() || !F.hasExactDefinition())
+    if (isFunctionSkipped(F))
       continue;
 
     auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
@@ -134,6 +138,9 @@ void checkDebugifyMetadata(Module &M) {
   // Find missing lines.
   BitVector MissingLines{OriginalNumLines, true};
   for (Function &F : M) {
+    if (isFunctionSkipped(F))
+      continue;
+
     for (Instruction &I : instructions(F)) {
       if (isa<DbgValueInst>(&I))
         continue;
@@ -156,6 +163,9 @@ void checkDebugifyMetadata(Module &M) {
   // Find missing variables.
   BitVector MissingVars{OriginalNumVars, true};
   for (Function &F : M) {
+    if (isFunctionSkipped(F))
+      continue;
+
     for (Instruction &I : instructions(F)) {
       auto *DVI = dyn_cast<DbgValueInst>(&I);
       if (!DVI)




More information about the llvm-commits mailing list