[llvm] r186634 - Debug Info: enable verifying by default and disable testing cases that fail.

Manman Ren mren at apple.com
Thu Jul 18 17:31:04 PDT 2013


Author: mren
Date: Thu Jul 18 19:31:03 2013
New Revision: 186634

URL: http://llvm.org/viewvc/llvm-project?rev=186634&view=rev
Log:
Debug Info: enable verifying by default and disable testing cases that fail.

1> Use DebugInfoFinder to find debug info MDNodes.
2> Add disable-debug-info-verifier to disable verifying debug info.
3> Disable verifying for testing cases that fail (will update the testing cases
   later on).
4> MDNodes generated by clang can have empty filename for TAG_inheritance and
   TAG_friend, so DIType::Verify is modified accordingly.

Note that DebugInfoFinder does not list all debug info MDNode.
For example, clang can generate:
metadata !{i32 786468}, which will fail to verify.
This MDNode is used by debug info but not included in DebugInfoFinder.
This MDNode is generated as a temporary node in DIBuilder::createFunction
  Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
  MDNode::getTemporary(VMContext, TElts)

Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp
    llvm/trunk/lib/IR/Verifier.cpp
    llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
    llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll
    llvm/trunk/test/CodeGen/X86/dbg-i128-const.ll
    llvm/trunk/test/CodeGen/X86/dbg-subrange.ll
    llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll
    llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll
    llvm/trunk/test/CodeGen/X86/dbg-value-location.ll
    llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll
    llvm/trunk/test/DebugInfo/2010-04-19-FramePtr.ll
    llvm/trunk/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
    llvm/trunk/test/DebugInfo/X86/2011-12-16-BadStructRef.ll
    llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
    llvm/trunk/test/DebugInfo/X86/linkage-name.ll
    llvm/trunk/test/DebugInfo/X86/low-pc-cu.ll
    llvm/trunk/test/DebugInfo/X86/multiple-at-const-val.ll

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Thu Jul 18 19:31:03 2013
@@ -459,6 +459,8 @@ bool DIType::Verify() const {
       Tag != dwarf::DW_TAG_array_type &&
       Tag != dwarf::DW_TAG_enumeration_type &&
       Tag != dwarf::DW_TAG_subroutine_type &&
+      Tag != dwarf::DW_TAG_inheritance &&
+      Tag != dwarf::DW_TAG_friend &&
       getFilename().empty())
     return false;
   return true;

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jul 18 19:31:03 2013
@@ -53,6 +53,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Assembly/Writer.h"
+#include "llvm/DebugInfo.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DerivedTypes.h"
@@ -66,6 +67,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/CallSite.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -74,6 +76,9 @@
 #include <cstdarg>
 using namespace llvm;
 
+static cl::opt<bool> DisableDebugInfoVerifier("disable-debug-info-verifier",
+                                              cl::init(false));
+
 namespace {  // Anonymous namespace for class
   struct PreVerifier : public FunctionPass {
     static char ID; // Pass ID, replacement for typeid
@@ -202,6 +207,9 @@ namespace {
 
       visitModuleFlags(M);
 
+      // Verify Debug Info.
+      verifyDebugInfo(M);
+
       // If the module is broken, abort at this time.
       return abortIfBroken();
     }
@@ -309,6 +317,8 @@ namespace {
     void VerifyFunctionAttrs(FunctionType *FT, AttributeSet Attrs,
                              const Value *V);
 
+    void verifyDebugInfo(Module &M);
+
     void WriteValue(const Value *V) {
       if (!V) return;
       if (isa<Instruction>(V)) {
@@ -2185,6 +2195,28 @@ void Verifier::visitIntrinsicFunctionCal
   }
 }
 
+void Verifier::verifyDebugInfo(Module &M) {
+  // Verify Debug Info.
+  if (!DisableDebugInfoVerifier) {
+    DebugInfoFinder Finder;
+    Finder.processModule(M);
+
+    for (DebugInfoFinder::iterator I = Finder.compile_unit_begin(),
+         E = Finder.compile_unit_end(); I != E; ++I)
+      Assert1(DICompileUnit(*I).Verify(), "DICompileUnit does not Verify!", *I);
+    for (DebugInfoFinder::iterator I = Finder.subprogram_begin(),
+         E = Finder.subprogram_end(); I != E; ++I)
+      Assert1(DISubprogram(*I).Verify(), "DISubprogram does not Verify!", *I);
+    for (DebugInfoFinder::iterator I = Finder.global_variable_begin(),
+         E = Finder.global_variable_end(); I != E; ++I)
+      Assert1(DIGlobalVariable(*I).Verify(),
+              "DIGlobalVariable does not Verify!", *I);
+    for (DebugInfoFinder::iterator I = Finder.type_begin(),
+         E = Finder.type_end(); I != E; ++I)
+      Assert1(DIType(*I).Verify(), "DIType does not Verify!", *I);
+  }
+}
+
 //===----------------------------------------------------------------------===//
 //  Implement the public interfaces to this file...
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll Thu Jul 18 19:31:03 2013
@@ -1,5 +1,5 @@
-; RUN: llc -O2 < %s | FileCheck %s
-; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s
+; RUN: llc -O2 -disable-debug-info-verifier < %s | FileCheck %s
+; RUN: llc -O2 -disable-debug-info-verifier -regalloc=basic < %s | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10"
 

Modified: llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-08-04-StackVariable.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s | grep DW_OP_breg7
+; RUN: llc -O0 -mtriple=x86_64-apple-darwin -disable-debug-info-verifier < %s | grep DW_OP_breg7
 ; Use DW_OP_breg7 in variable's location expression if the variable is in a stack slot.
 
 %struct.SVal = type { i8*, i32 }

Modified: llvm/trunk/test/CodeGen/X86/dbg-i128-const.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-i128-const.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-i128-const.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-i128-const.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-linux -disable-debug-info-verifier < %s | FileCheck %s
 
 ; CHECK: DW_AT_const_value
 ; CHECK-NEXT: 42

Modified: llvm/trunk/test/CodeGen/X86/dbg-subrange.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-subrange.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-subrange.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-subrange.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -O0 < %s | FileCheck %s
+; RUN: llc -O0 -disable-debug-info-verifier < %s | FileCheck %s
 ; Radar 10464995
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.7.2"

Modified: llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc < %s | FileCheck %s
+; RUN: llc -disable-debug-info-verifier < %s | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0.0"
 ; PR 9817

Modified: llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc < %s | FileCheck %s
+; RUN: llc -disable-debug-info-verifier < %s | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0.0"
 ; PR 9879

Modified: llvm/trunk/test/CodeGen/X86/dbg-value-location.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-location.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-value-location.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-value-location.ll Thu Jul 18 19:31:03 2013
@@ -1,5 +1,5 @@
-; RUN: llc < %s | FileCheck %s
-; RUN: llc < %s -regalloc=basic | FileCheck %s
+; RUN: llc -disable-debug-info-verifier < %s | FileCheck %s
+; RUN: llc -disable-debug-info-verifier < %s -regalloc=basic | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-darwin10.0.0"
 ;Radar 8950491

Modified: llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll (original)
+++ llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -asm-verbose -O0 | grep AT_specification | count 2
+; RUN: llvm-as -disable-debug-info-verifier < %s | llc -asm-verbose -O0 -disable-debug-info-verifier | grep AT_specification | count 2
 ; Radar 7833483
 ; Do not emit AT_specification for nested function foo.
 

Modified: llvm/trunk/test/DebugInfo/2010-04-19-FramePtr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-04-19-FramePtr.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-04-19-FramePtr.ll (original)
+++ llvm/trunk/test/DebugInfo/2010-04-19-FramePtr.ll Thu Jul 18 19:31:03 2013
@@ -1,6 +1,6 @@
-; RUN: llc -asm-verbose -O1 -o %t < %s 
+; RUN: llc -disable-debug-info-verifier -asm-verbose -O1 -o %t < %s 
 ; RUN: grep DW_AT_APPLE_omit_frame_ptr %t
-; RUN: llc -disable-fp-elim -asm-verbose -O1 -o %t < %s 
+; RUN: llc -disable-debug-info-verifier -disable-fp-elim -asm-verbose -O1 -o %t < %s 
 ; RUN: grep -v DW_AT_APPLE_omit_frame_ptr %t
 
 

Modified: llvm/trunk/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -disable-debug-info-verifier %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; ModuleID = 'test.c'

Modified: llvm/trunk/test/DebugInfo/X86/2011-12-16-BadStructRef.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/2011-12-16-BadStructRef.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/2011-12-16-BadStructRef.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/2011-12-16-BadStructRef.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-apple-macosx10.7 %s -o %t -filetype=obj
+; RUN: llc -mtriple=x86_64-apple-macosx10.7 -disable-debug-info-verifier %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; CHECK: b_ref

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll Thu Jul 18 19:31:03 2013
@@ -1,6 +1,6 @@
-; RUN: llc -mtriple=x86_64-apple-darwin %s -filetype=obj -o %t
+; RUN: llc -mtriple=x86_64-apple-darwin -disable-debug-info-verifier %s -filetype=obj -o %t
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
-; RUN: llc -mtriple=x86_64-apple-darwin -regalloc=basic %s -filetype=obj -o %t
+; RUN: llc -mtriple=x86_64-apple-darwin -disable-debug-info-verifier -regalloc=basic %s -filetype=obj -o %t
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ;CHECK: DW_TAG_inlined_subroutine

Modified: llvm/trunk/test/DebugInfo/X86/linkage-name.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/linkage-name.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/linkage-name.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/linkage-name.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-macosx -darwin-gdb-compat=Disable %s -o %t -filetype=obj
+; RUN: llc -mtriple=x86_64-macosx -disable-debug-info-verifier -darwin-gdb-compat=Disable %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; CHECK: DW_TAG_subprogram [9] *

Modified: llvm/trunk/test/DebugInfo/X86/low-pc-cu.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/low-pc-cu.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/low-pc-cu.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/low-pc-cu.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
+; RUN: llc -mtriple=x86_64-apple-darwin -disable-debug-info-verifier %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; Check that we use DW_AT_low_pc

Modified: llvm/trunk/test/DebugInfo/X86/multiple-at-const-val.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/multiple-at-const-val.ll?rev=186634&r1=186633&r2=186634&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/multiple-at-const-val.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/multiple-at-const-val.ll Thu Jul 18 19:31:03 2013
@@ -1,4 +1,4 @@
-; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
+; RUN: llc -O0 -disable-debug-info-verifier %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
 ; RUN: llvm-dwarfdump %t | FileCheck %s
 
 ; rdar://13071590





More information about the llvm-commits mailing list