[llvm] r186902 - Debug Info Finder: use processDeclare and processValue to list debug info
NAKAMURA Takumi
geek4civic at gmail.com
Mon Jul 22 23:44:54 PDT 2013
Manman, I added -disable-debug-info-verifier to another test in r186930.
http://bb.pgr.jp/builders/clang-3stage-cygwin/builds/677
DIType does not Verify!
metadata !11
Broken module found, compilation aborted!
2013/7/23 Manman Ren <manman.ren at gmail.com>:
> Author: mren
> Date: Mon Jul 22 19:22:51 2013
> New Revision: 186902
>
> URL: http://llvm.org/viewvc/llvm-project?rev=186902&view=rev
> Log:
> Debug Info Finder: use processDeclare and processValue to list debug info
> MDNodes used by DbgDeclareInst and DbgValueInst.
>
> Another 16 testing cases failed and they are disabled with
> -disable-debug-info-verifier.
> A total of 34 cases are disabled with -disable-debug-info-verifier and will be
> corrected.
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo.h
> llvm/trunk/lib/IR/DebugInfo.cpp
> llvm/trunk/lib/IR/Verifier.cpp
> llvm/trunk/test/Assembler/functionlocal-metadata.ll
> llvm/trunk/test/CodeGen/ARM/2010-04-15-ScavengerDebugValue.ll
> llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll
> llvm/trunk/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll
> llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll
> llvm/trunk/test/CodeGen/X86/2010-11-02-DbgParameter.ll
> llvm/trunk/test/CodeGen/X86/dbg-declare-arg.ll
> llvm/trunk/test/DebugInfo/2010-03-30-InvalidDbgInfoCrash.ll
> llvm/trunk/test/DebugInfo/2010-05-03-DisableFramePtr.ll
> llvm/trunk/test/DebugInfo/2010-05-03-OriginDIE.ll
> llvm/trunk/test/DebugInfo/2010-10-01-crash.ll
> llvm/trunk/test/DebugInfo/X86/earlydup-crash.ll
> llvm/trunk/test/DebugInfo/X86/pr12831.ll
> llvm/trunk/test/DebugInfo/inheritance.ll
> llvm/trunk/test/Linker/2011-08-18-unique-class-type.ll
> llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll
>
> Modified: llvm/trunk/include/llvm/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo.h Mon Jul 22 19:22:51 2013
> @@ -31,6 +31,7 @@ namespace llvm {
> class Type;
> class Value;
> class DbgDeclareInst;
> + class DbgValueInst;
> class Instruction;
> class MDNode;
> class NamedMDNode;
> @@ -734,12 +735,23 @@ namespace llvm {
> /// cleanseInlinedVariable - Remove inlined scope from the variable.
> DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
>
> + /// DebugInfoFinder tries to list all debug info MDNodes in a module. To
> + /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
> + /// processDeclare and processValue. processModule will go through
> + /// all DICompileUnits and list debug info MDNodes used by the CUs.
> class DebugInfoFinder {
> public:
> /// processModule - Process entire module and collect debug info
> /// anchors.
> void processModule(const Module &M);
>
> + /// processDeclare - Process DbgDeclareInst.
> + void processDeclare(const DbgDeclareInst *DDI);
> + /// Process DbgValueInst.
> + void processValue(const DbgValueInst *DVI);
> +
> + /// Clear all lists.
> + void reset();
> private:
> /// processType - Process DIType.
> void processType(DIType DT);
> @@ -750,9 +762,6 @@ namespace llvm {
> /// processSubprogram - Process DISubprogram.
> void processSubprogram(DISubprogram SP);
>
> - /// processDeclare - Process DbgDeclareInst.
> - void processDeclare(const DbgDeclareInst *DDI);
> -
> /// processLocation - Process DILocation.
> void processLocation(DILocation Loc);
>
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Jul 22 19:22:51 2013
> @@ -847,6 +847,15 @@ bool llvm::isSubprogramContext(const MDN
> // DebugInfoFinder implementations.
> //===----------------------------------------------------------------------===//
>
> +void DebugInfoFinder::reset() {
> + CUs.clear();
> + SPs.clear();
> + GVs.clear();
> + TYs.clear();
> + Scopes.clear();
> + NodesSeen.clear();
> +}
> +
> /// processModule - Process entire module and collect debug info.
> void DebugInfoFinder::processModule(const Module &M) {
> if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
> @@ -962,6 +971,19 @@ void DebugInfoFinder::processDeclare(con
> if (!N) return;
>
> DIDescriptor DV(N);
> + if (!DV.isVariable())
> + return;
> +
> + if (!NodesSeen.insert(DV))
> + return;
> + processType(DIVariable(N).getType());
> +}
> +
> +void DebugInfoFinder::processValue(const DbgValueInst *DVI) {
> + MDNode *N = dyn_cast<MDNode>(DVI->getVariable());
> + if (!N) return;
> +
> + DIDescriptor DV(N);
> if (!DV.isVariable())
> return;
>
>
> Modified: llvm/trunk/lib/IR/Verifier.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Verifier.cpp (original)
> +++ llvm/trunk/lib/IR/Verifier.cpp Mon Jul 22 19:22:51 2013
> @@ -147,6 +147,9 @@ namespace {
> /// the same personality function.
> const Value *PersonalityFn;
>
> + /// Finder keeps track of all debug info MDNodes in a Module.
> + DebugInfoFinder Finder;
> +
> Verifier()
> : FunctionPass(ID), Broken(false),
> action(AbortProcessAction), Mod(0), Context(0), DT(0),
> @@ -162,6 +165,7 @@ namespace {
> bool doInitialization(Module &M) {
> Mod = &M;
> Context = &M.getContext();
> + Finder.reset();
>
> // We must abort before returning back to the pass manager, or else the
> // pass manager may try to run other passes on the broken module.
> @@ -2144,7 +2148,17 @@ void Verifier::visitIntrinsicFunctionCal
> MDNode *MD = cast<MDNode>(CI.getArgOperand(0));
> Assert1(MD->getNumOperands() == 1,
> "invalid llvm.dbg.declare intrinsic call 2", &CI);
> + if (!DisableDebugInfoVerifier)
> + Finder.processDeclare(cast<DbgDeclareInst>(&CI));
> } break;
> + case Intrinsic::dbg_value: { //llvm.dbg.value
> + if (!DisableDebugInfoVerifier) {
> + Assert1(CI.getArgOperand(0) && isa<MDNode>(CI.getArgOperand(0)),
> + "invalid llvm.dbg.value intrinsic call 1", &CI);
> + Finder.processValue(cast<DbgValueInst>(&CI));
> + }
> + break;
> + }
> case Intrinsic::memcpy:
> case Intrinsic::memmove:
> case Intrinsic::memset:
> @@ -2209,7 +2223,6 @@ 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(),
>
> Modified: llvm/trunk/test/Assembler/functionlocal-metadata.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/functionlocal-metadata.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/Assembler/functionlocal-metadata.ll (original)
> +++ llvm/trunk/test/Assembler/functionlocal-metadata.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llvm-as < %s | llvm-dis | FileCheck %s
> +; RUN: llvm-as -disable-debug-info-verifier < %s | llvm-dis | FileCheck %s
>
> define void @Foo(i32 %a, i32 %b) {
> entry:
>
> Modified: llvm/trunk/test/CodeGen/ARM/2010-04-15-ScavengerDebugValue.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-04-15-ScavengerDebugValue.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/ARM/2010-04-15-ScavengerDebugValue.ll (original)
> +++ llvm/trunk/test/CodeGen/ARM/2010-04-15-ScavengerDebugValue.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc < %s
> +; RUN: llc -disable-debug-info-verifier < %s
> ; PR6847
> target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64-n32"
> target triple = "armv4t-apple-darwin10"
>
> Modified: llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll (original)
> +++ llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -O0 < %s | FileCheck %s
> +; RUN: llc -O0 -disable-debug-info-verifier < %s | FileCheck %s
> ; CHECK: @DEBUG_VALUE: mydata <- [SP+{{[0-9]+}}]
> ; Radar 9331779
> target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
>
> Modified: llvm/trunk/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -O1 < %s
> +; RUN: llc -O1 -disable-debug-info-verifier < %s
> ; ModuleID = 'pr6157.bc'
> ; formerly crashed in SelectionDAGBuilder
>
>
> Modified: llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll Mon Jul 22 19:22:51 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 -regalloc=basic -disable-debug-info-verifier < %s | FileCheck %s
> ; Test to check that unused argument 'this' is not undefined in debug info.
>
> target triple = "x86_64-apple-darwin10.2"
>
> Modified: llvm/trunk/test/CodeGen/X86/2010-11-02-DbgParameter.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-11-02-DbgParameter.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/2010-11-02-DbgParameter.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/2010-11-02-DbgParameter.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -O2 -asm-verbose < %s | FileCheck %s
> +; RUN: llc -O2 -disable-debug-info-verifier -asm-verbose < %s | FileCheck %s
> ; Radar 8616981
>
> target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
>
> Modified: llvm/trunk/test/CodeGen/X86/dbg-declare-arg.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-declare-arg.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/dbg-declare-arg.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/dbg-declare-arg.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -O0 -fast-isel=false < %s | FileCheck %s
> +; RUN: llc -O0 -fast-isel=false -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-macosx10.6.7"
> ;Radar 9321650
>
> Modified: llvm/trunk/test/DebugInfo/2010-03-30-InvalidDbgInfoCrash.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-03-30-InvalidDbgInfoCrash.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/2010-03-30-InvalidDbgInfoCrash.ll (original)
> +++ llvm/trunk/test/DebugInfo/2010-03-30-InvalidDbgInfoCrash.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc < %s -o /dev/null
> +; RUN: llc -disable-debug-info-verifier < %s -o /dev/null
>
> define void @baz(i32 %i) nounwind ssp {
> entry:
>
> Modified: llvm/trunk/test/DebugInfo/2010-05-03-DisableFramePtr.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-05-03-DisableFramePtr.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/2010-05-03-DisableFramePtr.ll (original)
> +++ llvm/trunk/test/DebugInfo/2010-05-03-DisableFramePtr.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -o /dev/null -disable-non-leaf-fp-elim < %s
> +; RUN: llc -disable-debug-info-verifier -o /dev/null -disable-non-leaf-fp-elim < %s
> ; Radar 7937664
> %struct.AppleEvent = type opaque
>
>
> Modified: llvm/trunk/test/DebugInfo/2010-05-03-OriginDIE.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-05-03-OriginDIE.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/2010-05-03-OriginDIE.ll (original)
> +++ llvm/trunk/test/DebugInfo/2010-05-03-OriginDIE.ll Mon Jul 22 19:22:51 2013
> @@ -1,5 +1,5 @@
>
> -;RUN: llc < %s -o /dev/null
> +;RUN: llc -disable-debug-info-verifier < %s -o /dev/null
> ;Radar 7937109
>
> %struct.anon = type { i64, i32, i32, i32, [1 x i32] }
>
> Modified: llvm/trunk/test/DebugInfo/2010-10-01-crash.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-10-01-crash.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/2010-10-01-crash.ll (original)
> +++ llvm/trunk/test/DebugInfo/2010-10-01-crash.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc -O0 %s -o /dev/null
> +; RUN: llc -O0 -disable-debug-info-verifier %s -o /dev/null
> ; XFAIL: hexagon
> ; PR 8235
>
>
> Modified: llvm/trunk/test/DebugInfo/X86/earlydup-crash.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/earlydup-crash.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/earlydup-crash.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/earlydup-crash.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc %s -mtriple=i386-apple-macosx10.6.7 -o /dev/null
> +; RUN: llc -disable-debug-info-verifier %s -mtriple=i386-apple-macosx10.6.7 -o /dev/null
>
> ; This used to crash because early dup was not ignoring debug instructions.
>
>
> Modified: llvm/trunk/test/DebugInfo/X86/pr12831.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pr12831.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/pr12831.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/pr12831.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -o /dev/null
> +; RUN: llc -disable-debug-info-verifier %s -mtriple=x86_64-unknown-linux-gnu -o /dev/null
>
> 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-unknown-linux-gnu"
>
> Modified: llvm/trunk/test/DebugInfo/inheritance.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/inheritance.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/inheritance.ll (original)
> +++ llvm/trunk/test/DebugInfo/inheritance.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llc %s -o /dev/null
> +; RUN: llc -disable-debug-info-verifier %s -o /dev/null
> ; PR 2613.
>
> %struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
>
> Modified: llvm/trunk/test/Linker/2011-08-18-unique-class-type.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2011-08-18-unique-class-type.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/Linker/2011-08-18-unique-class-type.ll (original)
> +++ llvm/trunk/test/Linker/2011-08-18-unique-class-type.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: llvm-link %s %p/2011-08-18-unique-class-type2.ll -S -o - | FileCheck %s
> +; RUN: llvm-link -disable-debug-info-verifier %s %p/2011-08-18-unique-class-type2.ll -S -o - | FileCheck %s
> ; CHECK: DW_TAG_class_type
> ; CHECK-NOT: DW_TAG_class_type
> ; Test to check there is only one MDNode for class A after linking.
>
> Modified: llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll?rev=186902&r1=186901&r2=186902&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll (original)
> +++ llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll Mon Jul 22 19:22:51 2013
> @@ -1,4 +1,4 @@
> -; RUN: opt -S -loop-rotate < %s | FileCheck %s
> +; RUN: opt -S -loop-rotate -disable-debug-info-verifier < %s | FileCheck %s
>
> declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
> declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list