<div dir="ltr">I'm wondering whether the LangRef part of the patch could be expanded to provide some more info about why a distinct metadata would be useful.<div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 8, 2015 at 2:38 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dexonsmith<br>
Date: Thu Jan  8 16:38:29 2015<br>
New Revision: 225474<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225474&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225474&view=rev</a><br>
Log:<br>
IR: Add 'distinct' MDNodes to bitcode and assembly<br>
<br>
Propagate whether `MDNode`s are 'distinct' through the other types of IR<br>
(assembly and bitcode).  This adds the `distinct` keyword to assembly.<br>
<br>
Currently, no one actually calls `MDNode::getDistinct()`, so these nodes<br>
only get created for:<br>
<br>
  - self-references, which are never uniqued, and<br>
  - nodes whose operands are replaced that hit a uniquing collision.<br>
<br>
The concept of distinct nodes is still not quite first-class, since<br>
distinct-ness doesn't yet survive across `MapMetadata()`.<br>
<br>
Part of PR22111.<br>
<br>
Added:<br>
    llvm/trunk/test/Assembler/distinct-mdnode.ll<br>
Modified:<br>
    llvm/trunk/docs/LangRef.rst<br>
    llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h<br>
    llvm/trunk/lib/AsmParser/LLLexer.cpp<br>
    llvm/trunk/lib/AsmParser/LLParser.cpp<br>
    llvm/trunk/lib/AsmParser/LLParser.h<br>
    llvm/trunk/lib/AsmParser/LLToken.h<br>
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp<br>
    llvm/trunk/lib/IR/AsmWriter.cpp<br>
    llvm/trunk/test/Transforms/Inline/noalias-calls.ll<br>
    llvm/trunk/test/Transforms/Inline/noalias-cs.ll<br>
    llvm/trunk/test/Transforms/Inline/noalias.ll<br>
    llvm/trunk/test/Transforms/Inline/noalias2.ll<br>
    llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll<br>
    llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll<br>
    llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll<br>
    llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll<br>
    llvm/trunk/utils/emacs/llvm-mode.el<br>
    llvm/trunk/utils/vim/llvm.vim<br>
<br>
Modified: llvm/trunk/docs/LangRef.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/docs/LangRef.rst (original)<br>
+++ llvm/trunk/docs/LangRef.rst Thu Jan  8 16:38:29 2015<br>
@@ -2848,6 +2848,12 @@ their operand. For example:<br>
<br>
     !{ !"test\00", i32 10}<br>
<br>
+Metadata nodes that aren't uniqued use the ``distinct`` keyword. For example:<br>
+<br>
+.. code-block:: llvm<br>
+<br>
+    !0 = distinct !{!"test\00", i32 10}<br>
+<br>
 A :ref:`named metadata <namedmetadatastructure>` is a collection of<br>
 metadata nodes, which can be looked up in the module symbol table. For<br>
 example:<br>
<br>
Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)<br>
+++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Thu Jan  8 16:38:29 2015<br>
@@ -140,7 +140,7 @@ namespace bitc {<br>
     METADATA_VALUE         = 2,   // VALUE:         [type num, value num]<br>
     METADATA_NODE          = 3,   // NODE:          [n x md num]<br>
     METADATA_NAME          = 4,   // STRING:        [values]<br>
-    // 5 is unused.<br>
+    METADATA_DISTINCT_NODE = 5,   // DISTINCT_NODE: [n x md num]<br>
     METADATA_KIND          = 6,   // [n x [id, name]]<br>
     // 7 is unused.<br>
     METADATA_OLD_NODE      = 8,   // OLD_NODE:      [n x (type num, value num)]<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)<br>
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Jan  8 16:38:29 2015<br>
@@ -655,6 +655,9 @@ lltok::Kind LLLexer::LexIdentifier() {<br>
   KEYWORD(x);<br>
   KEYWORD(blockaddress);<br>
<br>
+  // Metadata types.<br>
+  KEYWORD(distinct);<br>
+<br>
   // Use-list order directives.<br>
   KEYWORD(uselistorder);<br>
   KEYWORD(uselistorder_bb);<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)<br>
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jan  8 16:38:29 2015<br>
@@ -618,8 +618,9 @@ bool LLParser::ParseStandaloneMetadata()<br>
   if (Lex.getKind() == lltok::Type)<br>
     return TokError("unexpected type in metadata definition");<br>
<br>
+  bool IsDistinct = EatIfPresent(lltok::kw_distinct);<br>
   if (ParseToken(lltok::exclaim, "Expected '!' here") ||<br>
-      ParseMDNode(Init))<br>
+      ParseMDNode(Init, IsDistinct))<br>
     return true;<br>
<br>
   // See if this was forward referenced, if so, handle it.<br>
@@ -2945,12 +2946,15 @@ bool LLParser::ParseGlobalValueVector(Sm<br>
   return false;<br>
 }<br>
<br>
-bool LLParser::ParseMDNode(MDNode *&MD) {<br>
+bool LLParser::ParseMDNode(MDNode *&MD, bool IsDistinct) {<br>
   SmallVector<Metadata *, 16> Elts;<br>
   if (ParseMDNodeVector(Elts))<br>
     return true;<br>
<br>
-  MD = MDNode::get(Context, Elts);<br>
+  if (IsDistinct)<br>
+    MD = MDNode::getDistinct(Context, Elts);<br>
+  else<br>
+    MD = MDNode::get(Context, Elts);<br>
   return false;<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLParser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLParser.h (original)<br>
+++ llvm/trunk/lib/AsmParser/LLParser.h Thu Jan  8 16:38:29 2015<br>
@@ -389,7 +389,7 @@ namespace llvm {<br>
     bool ParseMetadataAsValue(Value *&V, PerFunctionState &PFS);<br>
     bool ParseValueAsMetadata(Metadata *&MD, PerFunctionState *PFS);<br>
     bool ParseMetadata(Metadata *&MD, PerFunctionState *PFS);<br>
-    bool ParseMDNode(MDNode *&MD);<br>
+    bool ParseMDNode(MDNode *&MD, bool IsDistinct = false);<br>
     bool ParseMDNodeVector(SmallVectorImpl<Metadata *> &MDs);<br>
     bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS);<br>
<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLToken.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLToken.h (original)<br>
+++ llvm/trunk/lib/AsmParser/LLToken.h Thu Jan  8 16:38:29 2015<br>
@@ -182,6 +182,9 @@ namespace lltok {<br>
     kw_extractelement, kw_insertelement, kw_shufflevector,<br>
     kw_extractvalue, kw_insertvalue, kw_blockaddress,<br>
<br>
+    // Metadata types.<br>
+    kw_distinct,<br>
+<br>
     // Use-list order directives.<br>
     kw_uselistorder, kw_uselistorder_bb,<br>
<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Jan  8 16:38:29 2015<br>
@@ -1106,6 +1106,7 @@ std::error_code BitcodeReader::ParseMeta<br>
     // Read a record.<br>
     Record.clear();<br>
     unsigned Code = Stream.readRecord(Entry.ID, Record);<br>
+    bool IsDistinct = false;<br>
     switch (Code) {<br>
     default:  // Default behavior: ignore.<br>
       break;<br>
@@ -1196,12 +1197,17 @@ std::error_code BitcodeReader::ParseMeta<br>
           NextMDValueNo++);<br>
       break;<br>
     }<br>
+    case bitc::METADATA_DISTINCT_NODE:<br>
+      IsDistinct = true;<br>
+      // fallthrough...<br>
     case bitc::METADATA_NODE: {<br>
       SmallVector<Metadata *, 8> Elts;<br>
       Elts.reserve(Record.size());<br>
       for (unsigned ID : Record)<br>
         Elts.push_back(ID ? MDValueList.getValueFwdRef(ID - 1) : nullptr);<br>
-      MDValueList.AssignValue(MDNode::get(Context, Elts), NextMDValueNo++);<br>
+      MDValueList.AssignValue(IsDistinct ? MDNode::getDistinct(Context, Elts)<br>
+                                         : MDNode::get(Context, Elts),<br>
+                              NextMDValueNo++);<br>
       break;<br>
     }<br>
     case bitc::METADATA_STRING: {<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Jan  8 16:38:29 2015<br>
@@ -773,7 +773,9 @@ static void WriteMDNode(const MDNode *N,<br>
     assert(!isa<LocalAsMetadata>(MD) && "Unexpected function-local metadata");<br>
     Record.push_back(VE.getMetadataID(MD) + 1);<br>
   }<br>
-  Stream.EmitRecord(bitc::METADATA_NODE, Record);<br>
+  Stream.EmitRecord(N->isDistinct() ? bitc::METADATA_DISTINCT_NODE<br>
+                                    : bitc::METADATA_NODE,<br>
+                    Record);<br>
   Record.clear();<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/lib/IR/AsmWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)<br>
+++ llvm/trunk/lib/IR/AsmWriter.cpp Thu Jan  8 16:38:29 2015<br>
@@ -1253,6 +1253,8 @@ static void WriteMDNodeBodyInternal(raw_<br>
                                     TypePrinting *TypePrinter,<br>
                                     SlotTracker *Machine,<br>
                                     const Module *Context) {<br>
+  if (Node->isDistinct())<br>
+    Out << "distinct ";<br>
   Out << "!{";<br>
   for (unsigned mi = 0, me = Node->getNumOperands(); mi != me; ++mi) {<br>
     const Metadata *MD = Node->getOperand(mi);<br>
<br>
Added: llvm/trunk/test/Assembler/distinct-mdnode.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/distinct-mdnode.ll?rev=225474&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/distinct-mdnode.ll?rev=225474&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Assembler/distinct-mdnode.ll (added)<br>
+++ llvm/trunk/test/Assembler/distinct-mdnode.ll Thu Jan  8 16:38:29 2015<br>
@@ -0,0 +1,28 @@<br>
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s<br>
+; RUN: verify-uselistorder %s<br>
+<br>
+!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10}<br>
+<br>
+!0 = !{}<br>
+!1 = !{}   ; This should merge with !0.<br>
+!2 = !{!0}<br>
+!3 = !{!0} ; This should merge with !2.<br>
+!4 = distinct !{}<br>
+!5 = distinct !{}<br>
+!6 = distinct !{!0}<br>
+!7 = distinct !{!0}<br>
+!8 = distinct !{!8}<br>
+!9 = distinct !{!9}<br>
+!10 = !{!10} ; This should become distinct.<br>
+<br>
+; CHECK: !named = !{!0, !0, !1, !1, !2, !3, !4, !5, !6, !7, !8}<br>
+; CHECK:      !0 = !{}<br>
+; CHECK-NEXT: !1 = !{!0}<br>
+; CHECK-NEXT: !2 = distinct !{}<br>
+; CHECK-NEXT: !3 = distinct !{}<br>
+; CHECK-NEXT: !4 = distinct !{!0}<br>
+; CHECK-NEXT: !5 = distinct !{!0}<br>
+; CHECK-NEXT: !6 = distinct !{!6}<br>
+; CHECK-NEXT: !7 = distinct !{!7}<br>
+; CHECK-NEXT: !8 = distinct !{!8}<br>
+; CHECK-NOT:  !<br>
<br>
Modified: llvm/trunk/test/Transforms/Inline/noalias-calls.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias-calls.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias-calls.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Inline/noalias-calls.ll (original)<br>
+++ llvm/trunk/test/Transforms/Inline/noalias-calls.ll Thu Jan  8 16:38:29 2015<br>
@@ -36,9 +36,9 @@ attributes #0 = { nounwind }<br>
 attributes #1 = { nounwind uwtable }<br>
<br>
 ; CHECK: !0 = !{!1}<br>
-; CHECK: !1 = !{!1, !2, !"hello: %c"}<br>
-; CHECK: !2 = !{!2, !"hello"}<br>
+; CHECK: !1 = distinct !{!1, !2, !"hello: %c"}<br>
+; CHECK: !2 = distinct !{!2, !"hello"}<br>
 ; CHECK: !3 = !{!4}<br>
-; CHECK: !4 = !{!4, !2, !"hello: %a"}<br>
+; CHECK: !4 = distinct !{!4, !2, !"hello: %a"}<br>
 ; CHECK: !5 = !{!4, !1}<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/Inline/noalias-cs.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias-cs.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias-cs.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Inline/noalias-cs.ll (original)<br>
+++ llvm/trunk/test/Transforms/Inline/noalias-cs.ll Thu Jan  8 16:38:29 2015<br>
@@ -47,36 +47,36 @@ entry:<br>
 attributes #0 = { nounwind uwtable }<br>
<br>
 !0 = !{!1}<br>
-!1 = !{!1, !2, !"hello: %a"}<br>
-!2 = !{!2, !"hello"}<br>
+!1 = distinct !{!1, !2, !"hello: %a"}<br>
+!2 = distinct !{!2, !"hello"}<br>
 !3 = !{!4, !6}<br>
-!4 = !{!4, !5, !"hello2: %a"}<br>
-!5 = !{!5, !"hello2"}<br>
-!6 = !{!6, !5, !"hello2: %b"}<br>
+!4 = distinct !{!4, !5, !"hello2: %a"}<br>
+!5 = distinct !{!5, !"hello2"}<br>
+!6 = distinct !{!6, !5, !"hello2: %b"}<br>
 !7 = !{!4}<br>
 !8 = !{!6}<br>
<br>
 ; CHECK: !0 = !{!1, !3}<br>
-; CHECK: !1 = !{!1, !2, !"hello2: %a"}<br>
-; CHECK: !2 = !{!2, !"hello2"}<br>
-; CHECK: !3 = !{!3, !2, !"hello2: %b"}<br>
+; CHECK: !1 = distinct !{!1, !2, !"hello2: %a"}<br>
+; CHECK: !2 = distinct !{!2, !"hello2"}<br>
+; CHECK: !3 = distinct !{!3, !2, !"hello2: %b"}<br>
 ; CHECK: !4 = !{!1}<br>
 ; CHECK: !5 = !{!3}<br>
 ; CHECK: !6 = !{!7, !9, !10}<br>
-; CHECK: !7 = !{!7, !8, !"hello2: %a"}<br>
-; CHECK: !8 = !{!8, !"hello2"}<br>
-; CHECK: !9 = !{!9, !8, !"hello2: %b"}<br>
-; CHECK: !10 = !{!10, !11, !"hello: %a"}<br>
-; CHECK: !11 = !{!11, !"hello"}<br>
+; CHECK: !7 = distinct !{!7, !8, !"hello2: %a"}<br>
+; CHECK: !8 = distinct !{!8, !"hello2"}<br>
+; CHECK: !9 = distinct !{!9, !8, !"hello2: %b"}<br>
+; CHECK: !10 = distinct !{!10, !11, !"hello: %a"}<br>
+; CHECK: !11 = distinct !{!11, !"hello"}<br>
 ; CHECK: !12 = !{!7}<br>
 ; CHECK: !13 = !{!9, !10}<br>
 ; CHECK: !14 = !{!9}<br>
 ; CHECK: !15 = !{!7, !10}<br>
 ; CHECK: !16 = !{!10}<br>
 ; CHECK: !17 = !{!18, !20}<br>
-; CHECK: !18 = !{!18, !19, !"hello2: %a"}<br>
-; CHECK: !19 = !{!19, !"hello2"}<br>
-; CHECK: !20 = !{!20, !19, !"hello2: %b"}<br>
+; CHECK: !18 = distinct !{!18, !19, !"hello2: %a"}<br>
+; CHECK: !19 = distinct !{!19, !"hello2"}<br>
+; CHECK: !20 = distinct !{!20, !19, !"hello2: %b"}<br>
 ; CHECK: !21 = !{!18, !10}<br>
 ; CHECK: !22 = !{!20}<br>
 ; CHECK: !23 = !{!20, !10}<br>
<br>
Modified: llvm/trunk/test/Transforms/Inline/noalias.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Inline/noalias.ll (original)<br>
+++ llvm/trunk/test/Transforms/Inline/noalias.ll Thu Jan  8 16:38:29 2015<br>
@@ -65,12 +65,12 @@ entry:<br>
 attributes #0 = { nounwind uwtable }<br>
<br>
 ; CHECK: !0 = !{!1}<br>
-; CHECK: !1 = !{!1, !2, !"hello: %a"}<br>
-; CHECK: !2 = !{!2, !"hello"}<br>
+; CHECK: !1 = distinct !{!1, !2, !"hello: %a"}<br>
+; CHECK: !2 = distinct !{!2, !"hello"}<br>
 ; CHECK: !3 = !{!4, !6}<br>
-; CHECK: !4 = !{!4, !5, !"hello2: %a"}<br>
-; CHECK: !5 = !{!5, !"hello2"}<br>
-; CHECK: !6 = !{!6, !5, !"hello2: %b"}<br>
+; CHECK: !4 = distinct !{!4, !5, !"hello2: %a"}<br>
+; CHECK: !5 = distinct !{!5, !"hello2"}<br>
+; CHECK: !6 = distinct !{!6, !5, !"hello2: %b"}<br>
 ; CHECK: !7 = !{!4}<br>
 ; CHECK: !8 = !{!6}<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/Inline/noalias2.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias2.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/noalias2.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Inline/noalias2.ll (original)<br>
+++ llvm/trunk/test/Transforms/Inline/noalias2.ll Thu Jan  8 16:38:29 2015<br>
@@ -72,24 +72,24 @@ entry:<br>
 ; CHECK: }<br>
<br>
 ; CHECK: !0 = !{!1}<br>
-; CHECK: !1 = !{!1, !2, !"hello: %c"}<br>
-; CHECK: !2 = !{!2, !"hello"}<br>
+; CHECK: !1 = distinct !{!1, !2, !"hello: %c"}<br>
+; CHECK: !2 = distinct !{!2, !"hello"}<br>
 ; CHECK: !3 = !{!4}<br>
-; CHECK: !4 = !{!4, !2, !"hello: %a"}<br>
+; CHECK: !4 = distinct !{!4, !2, !"hello: %a"}<br>
 ; CHECK: !5 = !{!6, !8}<br>
-; CHECK: !6 = !{!6, !7, !"hello: %c"}<br>
-; CHECK: !7 = !{!7, !"hello"}<br>
-; CHECK: !8 = !{!8, !9, !"foo: %c"}<br>
-; CHECK: !9 = !{!9, !"foo"}<br>
+; CHECK: !6 = distinct !{!6, !7, !"hello: %c"}<br>
+; CHECK: !7 = distinct !{!7, !"hello"}<br>
+; CHECK: !8 = distinct !{!8, !9, !"foo: %c"}<br>
+; CHECK: !9 = distinct !{!9, !"foo"}<br>
 ; CHECK: !10 = !{!11, !12}<br>
-; CHECK: !11 = !{!11, !7, !"hello: %a"}<br>
-; CHECK: !12 = !{!12, !9, !"foo: %a"}<br>
+; CHECK: !11 = distinct !{!11, !7, !"hello: %a"}<br>
+; CHECK: !12 = distinct !{!12, !9, !"foo: %a"}<br>
 ; CHECK: !13 = !{!8}<br>
 ; CHECK: !14 = !{!12}<br>
 ; CHECK: !15 = !{!16, !18}<br>
-; CHECK: !16 = !{!16, !17, !"hello2: %a"}<br>
-; CHECK: !17 = !{!17, !"hello2"}<br>
-; CHECK: !18 = !{!18, !17, !"hello2: %b"}<br>
+; CHECK: !16 = distinct !{!16, !17, !"hello2: %a"}<br>
+; CHECK: !17 = distinct !{!17, !"hello2"}<br>
+; CHECK: !18 = distinct !{!18, !17, !"hello2: %b"}<br>
 ; CHECK: !19 = !{!16}<br>
 ; CHECK: !20 = !{!18}<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll (original)<br>
+++ llvm/trunk/test/Transforms/LoopUnroll/runtime-loop.ll Thu Jan  8 16:38:29 2015<br>
@@ -115,6 +115,6 @@ for.end:<br>
   ret i16 %res.0.lcssa<br>
 }<br>
<br>
-; CHECK: !0 = !{!0, !1}<br>
+; CHECK: !0 = distinct !{!0, !1}<br>
 ; CHECK: !1 = !{!"llvm.loop.unroll.disable"}<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll (original)<br>
+++ llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll Thu Jan  8 16:38:29 2015<br>
@@ -138,12 +138,12 @@ for.inc5.1:<br>
 !10 = !{!"llvm.loop.unroll.count", i32 2}<br>
<br>
<br>
-; CHECK: ![[LOOP_1]] = !{![[LOOP_1]], ![[VEC_ENABLE:.*]], ![[WIDTH_8:.*]], ![[UNROLL_DISABLE:.*]]}<br>
+; CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[VEC_ENABLE:.*]], ![[WIDTH_8:.*]], ![[UNROLL_DISABLE:.*]]}<br>
 ; CHECK: ![[VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}<br>
 ; CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}<br>
 ; CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}<br>
-; CHECK: ![[LOOP_2]] = !{![[LOOP_2]], ![[UNROLL_FULL:.*]]}<br>
+; CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_FULL:.*]]}<br>
 ; CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}<br>
-; CHECK: ![[LOOP_3]] = !{![[LOOP_3]], ![[UNROLL_DISABLE:.*]]}<br>
-; CHECK: ![[LOOP_4]] = !{![[LOOP_4]], ![[UNROLL_DISABLE:.*]]}<br>
-; CHECK: ![[LOOP_5]] = !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]]}<br>
+; CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[UNROLL_DISABLE:.*]]}<br>
+; CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[UNROLL_DISABLE:.*]]}<br>
+; CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]]}<br>
<br>
Modified: llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll (original)<br>
+++ llvm/trunk/test/Transforms/LoopVectorize/X86/already-vectorized.ll Thu Jan  8 16:38:29 2015<br>
@@ -39,8 +39,8 @@ for.end:<br>
 }<br>
<br>
 ; Now, we check for the Hint metadata<br>
-; CHECK: [[vect]] = !{[[vect]], [[width:![0-9]+]], [[unroll:![0-9]+]]}<br>
+; CHECK: [[vect]] = distinct !{[[vect]], [[width:![0-9]+]], [[unroll:![0-9]+]]}<br>
 ; CHECK: [[width]] = !{!"llvm.loop.vectorize.width", i32 1}<br>
 ; CHECK: [[unroll]] = !{!"llvm.loop.interleave.count", i32 1}<br>
-; CHECK: [[scalar]] = !{[[scalar]], [[width]], [[unroll]]}<br>
+; CHECK: [[scalar]] = distinct !{[[scalar]], [[width]], [[unroll]]}<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll (original)<br>
+++ llvm/trunk/test/Transforms/LoopVectorize/vectorize-once.ll Thu Jan  8 16:38:29 2015<br>
@@ -68,10 +68,10 @@ _ZSt10accumulateIPiiET0_T_S2_S1_.exit:<br>
<br>
 attributes #0 = { nounwind readonly ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" }<br>
<br>
-; CHECK: !0 = !{!0, !1, !2}<br>
+; CHECK: !0 = distinct !{!0, !1, !2}<br>
 ; CHECK: !1 = !{!"llvm.loop.vectorize.width", i32 1}<br>
 ; CHECK: !2 = !{!"llvm.loop.interleave.count", i32 1}<br>
-; CHECK: !3 = !{!3, !1, !2}<br>
+; CHECK: !3 = distinct !{!3, !1, !2}<br>
<br>
 !0 = !{!0, !1}<br>
 !1 = !{!"llvm.loop.vectorize.width", i32 1}<br>
<br>
Modified: llvm/trunk/utils/emacs/llvm-mode.el<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/llvm-mode.el?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/llvm-mode.el?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/emacs/llvm-mode.el (original)<br>
+++ llvm/trunk/utils/emacs/llvm-mode.el Thu Jan  8 16:38:29 2015<br>
@@ -53,6 +53,8 @@<br>
    `(,(regexp-opt '("extractelement" "insertelement" "shufflevector") 'words) . font-lock-keyword-face)<br>
    ;; Aggregate ops<br>
    `(,(regexp-opt '("extractvalue" "insertvalue") 'words) . font-lock-keyword-face)<br>
+   ;; Metadata types<br>
+   `(,(regexp-opt '("distinct") 'words) . font-lock-keyword-face)<br>
    ;; Use-list order directives<br>
    `(,(regexp-opt '("uselistorder" "uselistorder_bb") 'words) . font-lock-keyword-face)<br>
<br>
<br>
Modified: llvm/trunk/utils/vim/llvm.vim<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vim/llvm.vim?rev=225474&r1=225473&r2=225474&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vim/llvm.vim?rev=225474&r1=225473&r2=225474&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/vim/llvm.vim (original)<br>
+++ llvm/trunk/utils/vim/llvm.vim Thu Jan  8 16:38:29 2015<br>
@@ -41,7 +41,7 @@ syn keyword llvmKeyword alignstack alway<br>
 syn keyword llvmKeyword arm_aapcscc arm_apcscc asm atomic available_externally<br>
 syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common<br>
 syn keyword llvmKeyword constant datalayout declare default define deplibs<br>
-syn keyword llvmKeyword dllexport dllimport except extern_weak external<br>
+syn keyword llvmKeyword distinct dllexport dllimport except extern_weak external<br>
 syn keyword llvmKeyword externally_initialized fastcc filter gc global hidden<br>
 syn keyword llvmKeyword initialexec inlinehint inreg intel_ocl_bicc inteldialect<br>
 syn keyword llvmKeyword internal linkonce linkonce_odr localdynamic localexec<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>