<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 - Only one label allowed per block without branch - not documented"
href="https://bugs.llvm.org/show_bug.cgi?id=39961">39961</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Only one label allowed per block without branch - not documented
</td>
</tr>
<tr>
<th>Product</th>
<td>Documentation
</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>General docs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jynelson@email.sc.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Labels are only allowed at the start of any given block. Labels within a block
will throw the error 'error: expected instruction opcode'.
This is not documented anywhere and I had a really hard time figuring this out
on my own. There is some mention of basic blocks in doxygen:
<a href="http://llvm.org/doxygen/group__LLVMCCoreValueBasicBlock.html">http://llvm.org/doxygen/group__LLVMCCoreValueBasicBlock.html</a> but it does not
mention that ONLY basic blocks can be used as labels.
For example, the following code is legal:
define i32 @main() {
return:
ret i32 0
}
but this code is illegal:
define i32 @main() {
%1 = add i32 0, 1
return:
ret i32 %1
}
and this code is legal again:
@.true_str = private unnamed_addr constant [5 x i8] c"true\00"
@.false_str = private unnamed_addr constant [6 x i8] c"false\00"
declare i32 @puts(i8* nocapture) nounwind
define i32 @main() {
entry:
%tmp2 = load i1, i1* @.true
br i1 %tmp2, label %logicendlabel2, label %logicrightlabel1
logicrightlabel1:
%tmp3 = load i1, i1* @.false
br label %logicendlabel2
logicendlabel2:
%tmp1 = phi i1 [ %tmp2, %entry ], [ %tmp3, %logicrightlabel1 ]
%tmp5 = getelementptr [5 x i8], [5 x i8]* @.true_str, i32 0, i64 0
%tmp6 = getelementptr [6 x i8], [6 x i8]* @.false_str, i32 0, i64 0
%tmp7 = icmp eq i1 %tmp1, 1
%tmp4 = select i1 %tmp7, i8* %tmp5, i8* %tmp6
%unused_register0 = call i32 @puts (i8* %tmp4)
ret i32 0
}</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>