<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:Kevin.Harris@unisys.com" title="Kevin W. Harris <Kevin.Harris@unisys.com>"> <span class="fn">Kevin W. Harris</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - New verifier complaining about bad TBAA metadata created during hoist-merge optimization"
   href="https://llvm.org/bugs/show_bug.cgi?id=31393">bug 31393</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - New verifier complaining about bad TBAA metadata created during hoist-merge optimization"
   href="https://llvm.org/bugs/show_bug.cgi?id=31393#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - New verifier complaining about bad TBAA metadata created during hoist-merge optimization"
   href="https://llvm.org/bugs/show_bug.cgi?id=31393">bug 31393</a>
              from <span class="vcard"><a class="email" href="mailto:Kevin.Harris@unisys.com" title="Kevin W. Harris <Kevin.Harris@unisys.com>"> <span class="fn">Kevin W. Harris</span></a>
</span></b>
        <pre>I forgot to mention - these mdXXX values (mdData, mdControl, mdMemory, mdGRS,
...) are used in the calls to setMetadata() for the various load and store
operations that we generate.

Anyway, thanks for the hint, I finally figured out the proper change to our
code sequence.  The Upgrade call for mdData can't be eliminated altogether,
because we use it directly for cases where we can't tell which finer grained
category it should belong to.  However, upgrading it CAN be delayed until all
the higher level metadata derived from it has been generated.  So the working
sequence looks like this:

    std::vector<Metadata*> elts;

    /* type-based alias analysis */
    NamedMDNode* nmd = pMod->getOrInsertNamedMetadata("tbaa"); // put root at
module level
    elts.resize(1);
    elts[0] = MDString::get(Context, "tbaa2200");
    mdRoot = MDNode::get(Context, elts);        // root
    mdRoot = UpgradeTBAANode(*mdRoot);
    nmd->addOperand(mdRoot);
    elts.resize(2);
    elts[1] = mdRoot;                           // same root for data and
control
    elts[0] = MDString::get(Context, "data");
    mdData = MDNode::get(Context, elts);        // 2200 data types
    elts[0] = MDString::get(Context, "ctrl");
    mdControl = MDNode::get(Context, elts);     // control types
    mdControl = UpgradeTBAANode(*mdControl);
    nmd->addOperand(mdControl);
    elts[1] = mdData;
    elts[0] = MDString::get(Context, "mem");
    mdMemory = MDNode::get(Context, elts);      // 2200 memory type
    mdMemory = UpgradeTBAANode(*mdMemory);
    nmd->addOperand(mdMemory);
    elts[0] = MDString::get(Context, "grs");
    mdGRS = MDNode::get(Context, elts);         // GRS type
    mdGRS = UpgradeTBAANode(*mdGRS);
    nmd->addOperand(mdGRS);
 . . .
    /* We delay upgrading mdData, because the mdXXX that derive from it must
       reference the original form, whereas the references to it from a load
       or store must use the upgraded form. */
    mdData = UpgradeTBAANode(*mdData);
    nmd->addOperand(mdData);

This seems to work for all our tests.  Thanks again!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>