<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - LLParser fails due to the "non-global-value-max-name-size" limit in Value.cpp"
href="https://bugs.llvm.org/show_bug.cgi?id=45899">45899</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLParser fails due to the "non-global-value-max-name-size" limit in Value.cpp
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM assembly language parser
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.holmen@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23478" name="attach_23478" title="bbi-42804.ll reproducer">attachment 23478</a> <a href="attachment.cgi?id=23478&action=edit" title="bbi-42804.ll reproducer">[details]</a></span>
bbi-42804.ll reproducer
Reproduce with:
opt -S -o - bbi-42804.ll
which gives
build-all-builtins/bin/opt: bbi-42804.ll:7:12: error: use of undefined value
'%for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.split_crit_edge.i.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit_edge.i.split.split.split_crit_edge.i.split.split.for.body4.lr.ph.split.split.split.us18.split.split.for.body4.lr.ph.split.split.split.us18.split.split.split_crit7'
but the value it complains on is indeed defined in the input file.
If we instead do
opt -S -o - bbi-42804.ll -non-global-value-max-name-size=1025
there is no error.
I don't know how things are supposed to work with the
"non-global-value-max-name-size" name limiit, but I think there is some
mismatch right now, where the LLParser doesn't consider that limit when it does
lookups in the symbol table in e.g LLParser::PerFunctionState::GetVal:
Value *LLParser::PerFunctionState::GetVal(const std::string &Name, Type *Ty,
LocTy Loc, bool IsCall) {
// Look this name up in the normal function symbol table.
Value *Val = F.getValueSymbolTable()->lookup(Name);
// If this is a forward reference for the value, see if we already created a
// forward ref record.
if (!Val) {
auto I = ForwardRefVals.find(Name);
if (I != ForwardRefVals.end())
Val = I->second.first;
}
// If we have the value in the symbol table or fwd-ref table, return it.
if (Val)
return P.checkValidVariableType(Loc, "%" + Name, Ty, Val, IsCall);
// Don't make placeholders with invalid type.
if (!Ty->isFirstClassType()) {
P.Error(Loc, "invalid use of a non-first-class type");
return nullptr;
}
// Otherwise, create a new forward reference for this value and remember it.
Value *FwdVal;
if (Ty->isLabelTy()) {
FwdVal = BasicBlock::Create(F.getContext(), Name, &F);
} else {
FwdVal = new Argument(Ty, Name);
}
"Name" above is not truncated, so the
Value *Val = F.getValueSymbolTable()->lookup(Name);
lookup tries to find the full name which fails even if it really shouldn't.
Then we create a new BasicBlock:
FwdVal = BasicBlock::Create(F.getContext(), Name, &F);
but there it will be a collision in the symboltable so we use
ValueSymbolTable::makeUniqueName which will add a unique number to the end of
the name and then we get some mismatch where someone thinks we're jumping to a
basic block that doesn't exist.</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>