[llvm-bugs] [Bug 31393] New verifier complaining about bad TBAA metadata created during hoist-merge optimization
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 21 11:53:14 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31393
Kevin W. Harris <Kevin.Harris at unisys.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Kevin W. Harris <Kevin.Harris at unisys.com> ---
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!
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161221/277c1965/attachment.html>
More information about the llvm-bugs
mailing list