r225475 - IR: Add 'distinct' MDNodes to bitcode and assembly (clang)

David Blaikie dblaikie at gmail.com
Fri Jan 9 10:07:54 PST 2015


On Fri, Jan 9, 2015 at 10:04 AM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2015-Jan-09, at 09:56, David Blaikie <dblaikie at gmail.com> wrote:
> >
> >
> >
> > On Thu, Jan 8, 2015 at 2:39 PM, Duncan P. N. Exon Smith <
> dexonsmith at apple.com> wrote:
> > Author: dexonsmith
> > Date: Thu Jan  8 16:39:28 2015
> > New Revision: 225475
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=225475&view=rev
> > Log:
> > IR: Add 'distinct' MDNodes to bitcode and assembly (clang)
> >
> > Update testcases for LLVM change in r225474 to make `MDNode`s explicitly
> > distinct (when they aren't uniqued).
> >
> > Part of PR22111.
> >
> > Modified:
> >     cfe/trunk/test/CodeGen/pragma-loop.cpp
> >     cfe/trunk/test/CodeGen/pragma-unroll.cpp
> >     cfe/trunk/test/CodeGenCXX/debug-info.cpp
> >     cfe/trunk/test/CodeGenCXX/vtable-holder-self-reference.cpp
> >     cfe/trunk/test/OpenMP/simd_metadata.c
> >
> > Modified: cfe/trunk/test/CodeGen/pragma-loop.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pragma-loop.cpp?rev=225475&r1=225474&r2=225475&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGen/pragma-loop.cpp (original)
> > +++ cfe/trunk/test/CodeGen/pragma-loop.cpp Thu Jan  8 16:39:28 2015
> > @@ -157,35 +157,35 @@ void template_test(double *List, int Len
> >    for_template_constant_expression_test<double, 2, 4, 8>(List, Length);
> >  }
> >
> > -// CHECK: ![[LOOP_1]] = !{![[LOOP_1]], ![[UNROLL_FULL:.*]],
> ![[WIDTH_4:.*]], ![[INTERLEAVE_4:.*]], ![[INTENABLE_1:.*]]}
> > +// CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]],
> ![[WIDTH_4:.*]], ![[INTERLEAVE_4:.*]], ![[INTENABLE_1:.*]]}
> >  // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
> >  // CHECK: ![[WIDTH_4]] = !{!"llvm.loop.vectorize.width", i32 4}
> >  // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
> >  // CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
> > -// CHECK: ![[LOOP_2]] = !{![[LOOP_2:.*]], ![[UNROLL_DISABLE:.*]],
> ![[INTERLEAVE_4:.*]], ![[WIDTH_8:.*]]}
> > +// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2:.*]],
> ![[UNROLL_DISABLE:.*]], ![[INTERLEAVE_4:.*]], ![[WIDTH_8:.*]]}
> >  // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
> >  // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
> > -// CHECK: ![[LOOP_3]] = !{![[LOOP_3]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_4:.*]], ![[ENABLE_1:.*]]}
> > +// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_4:.*]], ![[ENABLE_1:.*]]}
> >  // CHECK: ![[UNROLL_8]] = !{!"llvm.loop.unroll.count", i32 8}
> > -// CHECK: ![[LOOP_4]] = !{![[LOOP_4]], ![[INTERLEAVE_2:.*]],
> ![[WIDTH_2:.*]]}
> > +// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[INTERLEAVE_2:.*]],
> ![[WIDTH_2:.*]]}
> >  // CHECK: ![[INTERLEAVE_2]] = !{!"llvm.loop.interleave.count", i32 2}
> >  // CHECK: ![[WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
> > -// CHECK: ![[LOOP_5]] = !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]],
> ![[WIDTH_1:.*]]}
> > +// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]],
> ![[WIDTH_1:.*]]}
> >  // CHECK: ![[WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
> > -// CHECK: ![[LOOP_6]] = !{![[LOOP_6]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_2:.*]], ![[WIDTH_2:.*]]}
> > -// CHECK: ![[LOOP_7]] = !{![[LOOP_7]], ![[WIDTH_5:.*]]}
> > +// CHECK: ![[LOOP_6]] = distinct !{![[LOOP_6]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_2:.*]], ![[WIDTH_2:.*]]}
> > +// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[WIDTH_5:.*]]}
> >  // CHECK: ![[WIDTH_5]] = !{!"llvm.loop.vectorize.width", i32 5}
> > -// CHECK: ![[LOOP_8]] = !{![[LOOP_8]], ![[WIDTH_5:.*]]}
> > -// CHECK: ![[LOOP_9]] = !{![[LOOP_9]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_8:.*]], ![[WIDTH_8:.*]]}
> > +// CHECK: ![[LOOP_8]] = distinct !{![[LOOP_8]], ![[WIDTH_5:.*]]}
> > +// CHECK: ![[LOOP_9]] = distinct !{![[LOOP_9]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_8:.*]], ![[WIDTH_8:.*]]}
> >  // CHECK: ![[INTERLEAVE_8]] = !{!"llvm.loop.interleave.count", i32 8}
> > -// CHECK: ![[LOOP_10]] = !{![[LOOP_10]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_2:.*]], ![[WIDTH_2:.*]]}
> > -// CHECK: ![[LOOP_11]] = !{![[LOOP_11]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_4:.*]], ![[WIDTH_2:.*]]}
> > -// CHECK: ![[LOOP_12]] = !{![[LOOP_12]], ![[UNROLL_24:.*]],
> ![[INTERLEAVE_10:.*]], ![[WIDTH_6:.*]]}
> > +// CHECK: ![[LOOP_10]] = distinct !{![[LOOP_10]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_2:.*]], ![[WIDTH_2:.*]]}
> > +// CHECK: ![[LOOP_11]] = distinct !{![[LOOP_11]], ![[UNROLL_8:.*]],
> ![[INTERLEAVE_4:.*]], ![[WIDTH_2:.*]]}
> > +// CHECK: ![[LOOP_12]] = distinct !{![[LOOP_12]], ![[UNROLL_24:.*]],
> ![[INTERLEAVE_10:.*]], ![[WIDTH_6:.*]]}
> >  // CHECK: ![[UNROLL_24]] = !{!"llvm.loop.unroll.count", i32 24}
> >  // CHECK: ![[INTERLEAVE_10]] = !{!"llvm.loop.interleave.count", i32 10}
> >  // CHECK: ![[WIDTH_6]] = !{!"llvm.loop.vectorize.width", i32 6}
> > -// CHECK: ![[LOOP_13]] = !{![[LOOP_13]], ![[UNROLL_32:.*]],
> ![[INTERLEAVE_16:.*]], ![[WIDTH_8:.*]]}
> > +// CHECK: ![[LOOP_13]] = distinct !{![[LOOP_13]], ![[UNROLL_32:.*]],
> ![[INTERLEAVE_16:.*]], ![[WIDTH_8:.*]]}
> >  // CHECK: ![[UNROLL_32]] = !{!"llvm.loop.unroll.count", i32 32}
> >  // CHECK: ![[INTERLEAVE_16]] = !{!"llvm.loop.interleave.count", i32 16}
> > -// CHECK: ![[LOOP_14]] = !{![[LOOP_14]], ![[WIDTH_10:.*]]}
> > +// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[WIDTH_10:.*]]}
> >  // CHECK: ![[WIDTH_10]] = !{!"llvm.loop.vectorize.width", i32 10}
> >
> > Modified: cfe/trunk/test/CodeGen/pragma-unroll.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pragma-unroll.cpp?rev=225475&r1=225474&r2=225475&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGen/pragma-unroll.cpp (original)
> > +++ cfe/trunk/test/CodeGen/pragma-unroll.cpp Thu Jan  8 16:39:28 2015
> > @@ -86,14 +86,14 @@ void template_test(double *List, int Len
> >    for_template_define_test<double>(List, Length, Value);
> >  }
> >
> > -// CHECK: ![[LOOP_1]] = !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
> > +// CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
> >  // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
> > -// CHECK: ![[LOOP_2]] = !{![[LOOP_2:.*]], ![[UNROLL_DISABLE:.*]]}
> > +// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2:.*]],
> ![[UNROLL_DISABLE:.*]]}
> >  // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
> > -// CHECK: ![[LOOP_3]] = !{![[LOOP_3]], ![[UNROLL_8:.*]]}
> > +// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[UNROLL_8:.*]]}
> >  // CHECK: ![[UNROLL_8]] = !{!"llvm.loop.unroll.count", i32 8}
> > -// CHECK: ![[LOOP_4]] = !{![[LOOP_4]], ![[UNROLL_4:.*]]}
> > +// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[UNROLL_4:.*]]}
> >  // CHECK: ![[UNROLL_4]] = !{!"llvm.loop.unroll.count", i32 4}
> > -// CHECK: ![[LOOP_5]] = !{![[LOOP_5]], ![[UNROLL_8:.*]]}
> > -// CHECK: ![[LOOP_6]] = !{![[LOOP_6]], ![[UNROLL_8:.*]]}
> > -// CHECK: ![[LOOP_7]] = !{![[LOOP_7]], ![[UNROLL_8:.*]]}
> > +// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_8:.*]]}
> > +// CHECK: ![[LOOP_6]] = distinct !{![[LOOP_6]], ![[UNROLL_8:.*]]}
> > +// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[UNROLL_8:.*]]}
> >
> > Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=225475&r1=225474&r2=225475&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
> > +++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Thu Jan  8 16:39:28 2015
> > @@ -53,7 +53,7 @@ namespace VirtualBase {
> >    }
> >  }
> >
> > -// MSVC: [[VBASE_B:![0-9]+]] =
> !{!"0x13\00B\00{{[0-9]+}}\0096\0032\000\000\000", {{.*}}, null,
> [[VBASE_B_DEF:![0-9]+]], {{.*}}} ; [ DW_TAG_structure_type ] [B] [line 49,
> size 96, align 32, offset 0] [def] [from ]
> > +// MSVC: [[VBASE_B:![0-9]+]] = distinct
> !{!"0x13\00B\00{{[0-9]+}}\0096\0032\000\000\000", {{.*}}, null,
> [[VBASE_B_DEF:![0-9]+]], {{.*}}} ; [ DW_TAG_structure_type ] [B] [line 49,
> size 96, align 32, offset 0] [def] [from ]
> >
> > & with structure types being distinct MDNodes, how does this interact
> with the existing LTO debug info metadata type uniquing?
>
> (For those reading, any cycle in the debug info type graph prevents type
> uniquing from merging types between modules.)
>
> So I haven't actually changed structure types to be distinct MDNodes --
> these particular structs were already implicitly distinct because they
> have self-references.  This change just makes it obvious.
>

Ah, I assume that should be handled with a DIRef as other cases have?
(+Adrian for that)


> The self-reference is because of the DW_AT_CONTAINING_TYPE hack for GDB
> to find the vtable-holder.  (Is that hack is still necessary?  IIRC,
> it's explicitly invalid DWARF, since that attribute only belongs on
> DW_TAG_member_type nodes.)
>

Don't know - last time someone brought this up I suggested someone try
removing it & running the GDB test suite, but I don't think anyone has. I
haven't.


>
>
> >
> >  // MSVC: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]],
> >  //
> >  // Look for the vbtable offset of A, which should be 4.
> >
> > Modified: cfe/trunk/test/CodeGenCXX/vtable-holder-self-reference.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-holder-self-reference.cpp?rev=225475&r1=225474&r2=225475&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGenCXX/vtable-holder-self-reference.cpp (original)
> > +++ cfe/trunk/test/CodeGenCXX/vtable-holder-self-reference.cpp Thu Jan
> 8 16:39:28 2015
> > @@ -4,7 +4,7 @@
> >  // rid of self-referenceing structure_types (PR21902), then it should
> be safe
> >  // to just kill this test.
> >  //
> > -// CHECK: ![[SELF:[0-9]+]] = !{!"0x13\00B\00{{[^"]*}}", {{[^,]+}},
> {{[^,]+}}, {{[^,]+}}, {{[^,]+}}, ![[SELF]], {{[^}]+}}} ; [
> DW_TAG_structure_type ] [B]
> > +// CHECK: ![[SELF:[0-9]+]] = distinct !{!"0x13\00B\00{{[^"]*}}",
> {{[^,]+}}, {{[^,]+}}, {{[^,]+}}, {{[^,]+}}, ![[SELF]], {{[^}]+}}} ; [
> DW_TAG_structure_type ] [B]
> >
> >  void foo() {
> >    struct V {
> >
> > Modified: cfe/trunk/test/OpenMP/simd_metadata.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_metadata.c?rev=225475&r1=225474&r2=225475&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/OpenMP/simd_metadata.c (original)
> > +++ cfe/trunk/test/OpenMP/simd_metadata.c Thu Jan  8 16:39:28 2015
> > @@ -52,13 +52,13 @@ void h3(float *c, float *a, float *b, in
> >  }
> >
> >  // Metadata for h1:
> > -// CHECK: [[LOOP_H1_HEADER:![0-9]+]] = !{[[LOOP_H1_HEADER]],
> [[LOOP_WIDTH_16:![0-9]+]], [[LOOP_VEC_ENABLE:![0-9]+]]}
> > +// CHECK: [[LOOP_H1_HEADER:![0-9]+]] = distinct !{[[LOOP_H1_HEADER]],
> [[LOOP_WIDTH_16:![0-9]+]], [[LOOP_VEC_ENABLE:![0-9]+]]}
> >  // CHECK: [[LOOP_WIDTH_16]] = !{!"llvm.loop.vectorize.width", i32 16}
> >  // CHECK: [[LOOP_VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1
> true}
> >  //
> >  // Metadata for h2:
> > -// CHECK: [[LOOP_H2_HEADER]] = !{[[LOOP_H2_HEADER]],
> [[LOOP_VEC_ENABLE]]}
> > +// CHECK: [[LOOP_H2_HEADER]] = distinct !{[[LOOP_H2_HEADER]],
> [[LOOP_VEC_ENABLE]]}
> >  //
> >  // Metadata for h3:
> > -// CHECK: [[LOOP_H3_HEADER:![0-9]+]] = !{[[LOOP_H3_HEADER]],
> [[LOOP_VEC_ENABLE]]}
> > +// CHECK: [[LOOP_H3_HEADER:![0-9]+]] = distinct !{[[LOOP_H3_HEADER]],
> [[LOOP_VEC_ENABLE]]}
> >  //
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150109/cf708e14/attachment.html>


More information about the cfe-commits mailing list