<div dir="ltr">Agree, I think at least in the long term we'll want to have metadata attachments on globalobjects be represented with something equivalent to a multimap. The bitset metadata could also potentially benefit from a concept of multiple attachments per global, so I'll see if it would be worth doing it now.<div><br></div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 6, 2016 at 2:29 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">+1 or attaching metadata to globals.  I’d be curious if we can attach !range to a global representing an enum for example.  But…<div><div><br></div><div>Should we care about GlobalMerge for !dbg here?  Currently if we merge globals ‘a’ and ‘b’ in to __merged_global, i guess the DIGlobalVariable’s for ‘a’ and ‘b’ would now both point to the new __merged_global.</div><div><br></div><div>If thats the case, then by having the !dbg on the global, we wouldn’t be able to handle this case, unless you allow the !dbg to (optionally) point to a list of DIGlobalVariable’s.</div><div><br></div><div>BTW, this isn’t something I think should block this bug, but just wanted to point out that it could be an issue.  MergeFunction’s likely has a similar issue with !dbg on functions and I guess we don’t handle it there either.</div><div><br></div><div>Cheers</div><span class="HOEnZb"><font color="#888888"><div>Pete</div></font></span><div><div class="h5"><div><div><div><blockquote type="cite"><div>On May 6, 2016, at 2:23 PM, Philip Reames via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div>
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    +1.  I've seen a couple of cases where metadata on a global would be
    useful as an optimization hint as well.  <br>
    <br>
    Philip<br>
    <br>
    <div>On 05/06/2016 01:17 PM, Peter
      Collingbourne via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi all,
        <div><br>
        </div>
        <div>I'd like to add support for metadata attachments for global
          variables in the same way as we did for functions.</div>
        <div><br>
        </div>
        <div>
          <div>Syntax would be pretty simple:</div>
          <div>@foo = global i32 0, !foo !0, !bar !1</div>
          <div>(the extra commas are required to disambiguate from a
            named metadata on the next line)</div>
        </div>
        <div><br>
        </div>
        <div>Benefits:</div>
        <div>1) Lets us reverse the DIGlobalVariable ->
          GlobalVariable edge, which should hopefully clear the way for
          removing the <a href="http://llvm.dbg.cu/" target="_blank">llvm.dbg.cu</a> named metadata
          node.</div>
        <div><br>
        </div>
        <div>2) Allows for bitset metadata to be attached to globals
          rather than being represented as a named metadata node. This
          means that bitset metadata is naturally dropped when globals
          are dropped, and makes it easier to manipulate bitset metadata
          and build summaries of bitset definitions.</div>
        <div><br>
        </div>
        <div>Comments appreciated.</div>
        <div><br>
        </div>
        <div>Thanks,<br>
          -- <br>
          <div>
            <div dir="ltr">-- 
              <div>Peter</div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>