[llvm] r203983 - Debug info: Unique types before emitting them to DWARF, where applicable.

David Blaikie dblaikie at gmail.com
Fri Mar 14 17:59:28 PDT 2014


On Fri, Mar 14, 2014 at 4:08 PM, Adrian Prantl <aprantl at apple.com> wrote:
> Author: adrian
> Date: Fri Mar 14 18:08:29 2014
> New Revision: 203983
>
> URL: http://llvm.org/viewvc/llvm-project?rev=203983&view=rev
> Log:
> Debug info: Unique types before emitting them to DWARF, where applicable.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
>     llvm/trunk/test/Linker/type-unique-odr-a.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=203983&r1=203982&r2=203983&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Fri Mar 14 18:08:29 2014
> @@ -958,6 +958,9 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const
>    DIE *ContextDIE = getOrCreateContextDIE(Context);
>    assert(ContextDIE);
>
> +  // Unique the type. This is a noop if the type has no unique identifier.
> +  Ty = DIType(resolve(Ty.getRef()));

While this might be a good catch-all - I'm confused/concerned about
what this implies. How did we get here? We must have some code
referencing this type by node rather than name, yes? We should
probably find what that is and fix it because that would mean the type
won't be metadata node uniqued properly...

Might be worth just turning this into an assert instead so we can find
bugs like this more quickly if they arise.

> +
>    DIE *TyDIE = getDIE(Ty);
>    if (TyDIE)
>      return TyDIE;
>
> Modified: llvm/trunk/test/Linker/type-unique-odr-a.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/type-unique-odr-a.ll?rev=203983&r1=203982&r2=203983&view=diff
> ==============================================================================
> --- llvm/trunk/test/Linker/type-unique-odr-a.ll (original)
> +++ llvm/trunk/test/Linker/type-unique-odr-a.ll Fri Mar 14 18:08:29 2014
> @@ -28,6 +28,10 @@
>  ; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv"
>  ; CHECK:      DW_TAG_class_type
>  ; CHECK-NEXT:   DW_AT_name {{.*}} "A"
> +; CHECK-NOT:  DW_TAG
> +; CHECK:      DW_TAG_member
> +; CHECK-NEXT:   DW_AT_name {{.*}} "data"
> +; CHECK-NOT:  DW_TAG

This test case seems a little hard to read... maybe some explanatory comments?

>  ; CHECK:      DW_TAG_subprogram
>  ; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv"
>  ; CHECK-NEXT:   DW_AT_name {{.*}} "getFoo"
>
>
> _______________________________________________
> 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